Getting Options to Pass to a Script Based Filter

Paul pconklin at gentlemanslife.com
Thu Oct 21 09:04:12 PDT 2010


> So thanks to my last post, I at least have my script based filter working.  on to step 2.  Ideally to keep from making hundreds of PPD's and filters, I wanted to create options in my PPD so I can make my script flex based on what was chosen.  Example:
>
> *OpenUI *MOUNTFORM: PickOne
> *OrderDependency: 10 AnySetup *MOUNTFORM
> *DefaultMOUNTFORM: Normal
> *MOUNTFORM Normal: "^XA^PON^XZ"
> *MOUNTFORM Reversed: "^XA^POI^XZ"
> *CloseUI: *MOUNTFORM
>
> That was my first pass at just inserting zpl into the job (which is not what I'm ultimately trying to do.  Ideally I just want to pass what they selected to my script (perhaps in $5?) and I can do my ksh magic based off that (like inserting those special ascii values).  If anyone can provide advice or point me to a doc, it would be much appriceated.  Ideally I want to do something like
>
> *OpenUI *MOUNTFORM: PickOne
> *OrderDependency: 10 AnySetup *MOUNTFORM
> *DefaultMOUNTFORM: Normal
> *MOUNTFORM Normal: "NORMAL"
> *MOUNTFORM Reversed: "REVERSED"
> *MOUNTFORM 200DPI: "200DPI"
> *MOUNTFORM 400DPI: "400DPI"
> *CloseUI: *MOUNTFORM
>
> Then I can parse through what options they selected (moving to a PickMany, but for now using PickOne to get started)
>
> Thanks in advance.

I may have figured out how to do this, but I'm curious if anyone has a better way.  since there is an environment variable that points to the path of the PPD, I suppose I could cat <ppdfile> | grep '*DefaultMOUNTFORM:' | cut -f 2 -d ":", but that kinda seems like a hack way, is there a better way?





More information about the cups mailing list