Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1057 > unrolled thread

Can you send parameters to a postscript program

Started byCecil Westerhof <Cecil@decebal.nl>
First post2012-11-18 00:00 +0100
Last post2012-11-21 17:51 -0600
Articles 5 — 5 participants

Back to article view | Back to comp.lang.postscript


Contents

  Can you send parameters to a postscript program Cecil Westerhof <Cecil@decebal.nl> - 2012-11-18 00:00 +0100
    Re: Can you send parameters to a postscript program "luser.droog" <luser.droog@gmail.com> - 2012-11-17 19:29 -0600
      Re: Can you send parameters to a postscript program tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-11-17 22:49 -0500
    Re: Can you send parameters to a postscript program Don Lancaster <don@tinaja.com> - 2012-11-20 15:05 -0700
    Re: Can you send parameters to a postscript program bonomi@host122.r-bonomi.com (Robert Bonomi) - 2012-11-21 17:51 -0600

#1057 — Can you send parameters to a postscript program

FromCecil Westerhof <Cecil@decebal.nl>
Date2012-11-18 00:00 +0100
SubjectCan you send parameters to a postscript program
Message-ID<87y5hzdedi.fsf@Compaq.site.inet>
Is it possible to give parameters to a postscript program?

If so, is the following possible: I have defined colours. Say that I
want to use colorYellow. Can I give the string collorYellow to the
program and let setrgbcolour use the value of the variable
colorYellow?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [next] | [standalone]


#1058

From"luser.droog" <luser.droog@gmail.com>
Date2012-11-17 19:29 -0600
Message-ID<k89dl9$pnl$1@dont-email.me>
In reply to#1057
Cecil Westerhof wrote:

> Is it possible to give parameters to a postscript program?
> 
> If so, is the following possible: I have defined colours. Say that I
> want to use colorYellow. Can I give the string collorYellow to the
> program and let setrgbcolour use the value of the variable
> colorYellow?
> 

Yes, there are several ways to pass parameters into a PS program.

The most obvious would be to concatenate the definitions in front of the
program text and then execute the whole thing. This way will work on ANY ps
interpreter.

Or you can use ghostscript's "code" option:

  gs -c '/param1 12 def' prog.ps

Or ghostscript's "define" options:

  gs -dPARAM -dPARAM1=12 -sSTRING=string prog.ps

Or ghostcript's "argument-passing" option

  gs -- prog.ps arg0 arg1 arg2

which predefines '/ARGUMENTS [ (arg0) (arg1) (arg2) ] def' before executing.

[toc] | [prev] | [next] | [standalone]


#1062

Fromtlvp <mPiOsUcB.EtLlLvEp@att.net>
Date2012-11-17 22:49 -0500
Message-ID<xqzgvz55yh7l$.1yao1tp6dqmo.dlg@40tude.net>
In reply to#1058
On Sat, 17 Nov 2012 19:29:12 -0600, luser.droog wrote:

> Cecil Westerhof wrote:
> 
>> Is it possible to give parameters to a postscript program?
>> 
>> If so, is the following possible: I have defined colours. Say that I
>> want to use colorYellow. Can I give the string collorYellow to the
>> program and let setrgbcolour use the value of the variable
>> colorYellow?
>> 
> 
> Yes, there are several ways to pass parameters into a PS program.
> 
> The most obvious would be to concatenate the definitions in front of the
> program text and then execute the whole thing. This way will work on ANY ps
> interpreter.
> 
> Or you can use ghostscript's "code" option:
> 
>   gs -c '/param1 12 def' prog.ps
> 
> Or ghostscript's "define" options:
> 
>   gs -dPARAM -dPARAM1=12 -sSTRING=string prog.ps
> 
> Or ghostcript's "argument-passing" option
> 
>   gs -- prog.ps arg0 arg1 arg2
> 
> which predefines '/ARGUMENTS [ (arg0) (arg1) (arg2) ] def' before executing.

Alternatively, use a helper service like perl, owk, python, or the like, to
incorporate your argument-pegs into your postscript in the appropriate
cubby holes. 

That's what's done (using Python) by the proprietor of Bookland.py for
generating, on the fly, Bookland barcode (E)PS files given a web visitor's
provision of an ISBN number and, optionally, a (proposed) list price -- cf.
www.tux.org/~milgram/bookland/ .

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.

[toc] | [prev] | [next] | [standalone]


#1068

FromDon Lancaster <don@tinaja.com>
Date2012-11-20 15:05 -0700
Message-ID<ah2d59Fgqf5U1@mid.individual.net>
In reply to#1057
On 11/17/2012 4:00 PM, Cecil Westerhof wrote:
> Is it possible to give parameters to a postscript program?
>
> If so, is the following possible: I have defined colours. Say that I
> want to use colorYellow. Can I give the string collorYellow to the
> program and let setrgbcolour use the value of the variable
> colorYellow?
>


You mean like using "def" or "store"?


-- 
Many thanks,

Don Lancaster                          voice phone: (928)428-4073
Synergetics   3860 West First Street   Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml   email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com

[toc] | [prev] | [next] | [standalone]


#1069

Frombonomi@host122.r-bonomi.com (Robert Bonomi)
Date2012-11-21 17:51 -0600
Message-ID<i5SdnZF1V9ic9DDNnZ2dnUVZ_jGdnZ2d@posted.nuvoxcommunications>
In reply to#1057
In article <87y5hzdedi.fsf@Compaq.site.inet>,
Cecil Westerhof  <Cecil@decebal.nl> wrote:
>Is it possible to give parameters to a postscript program?

In the usual sense of 'tokens on a command-line, the answer is "no."

there are ways to 'play games' with an input stream _before_ it
reaches the actual postscript interpreter to accomplish equivalent
functionality.  These 'games' tend to be very specific to the exact
formatting/layout of a given 'style' (for lack of a better word) of
postscript program.  What works for 'a2ps' output will almost certainly
not work for MS-Word output, for example.

Also some postscript interpreter environments support the concept of
a 'filesystem'.  *IF* files in that filesystem are externally accessible,
then you can put values into a file and read that file inside the 
postscript program.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web