Environment variables in postscript templates 
Author Message
 Environment variables in postscript templates

Hello,

Is it possible to "load" shell environment variables into
a postscript file?

The reason for asking is that I have a  linux shell script
like this:

MY_VARIABLE= `output_of_some_command` # ASCII string

export MY_VARIABLE

enscript -use_template_so_and_so <some_file>

The "template_so_and_so" is a working Postscript file.
As it is, it already prints on top the standard
stuff (Date, Filename...)

So everything is OK, except the fact that I don't know how
to modify the PostScript file so that, after printing the
standard header, it loads from the environment the current
value of MY_VARIABLE and prints that.

Is there any way to do it?

I know that I could generate the whole template every time
with the current values, but I'd like something more
elegant and faster to write...

        Thank you in advance,

                        Marco Fioretti



Tue, 23 Dec 2003 19:53:17 GMT  
 Environment variables in postscript templates

Quote:

>Is it possible to "load" shell environment variables into
>a Postscript file?

How could that happen? A PostScript printer cannot reach back into
your computer to find the value of environment variables.

You should substitute the text in the PostScript file before you
print.  In fact, before you run Enscript for best results.
----------------------------------------

Visit http://www.*-*-*.com/ ,
PSAlter, psalters, tea, and small {*filter*} animals. And stuff.  



Tue, 23 Dec 2003 20:28:42 GMT  
 Environment variables in postscript templates

Quote:

> >Is it possible to "load" shell environment variables into
> >a Postscript file?

> How could that happen? A PostScript printer cannot reach back into
> your computer to find the value of environment variables.

> You should substitute the text in the PostScript file before you
> print.  In fact, before you run Enscript for best results.

Aandi,

of course a printer can't do anything like that. Sorry if my
message gave the impression I was trying to do this.

What I meant is: can I modify the PostScript template so
that, when **enscript** loads it, **before** sending anything
to the printer, it loads a string from some shell environment
variable, substitutes it on the fly in the template and goes?

I am pretty good with shell and perl scripting, but a complete
novice with PostScript. I also tried to find an enscript mailing
list, without success.

If you people here in the NG tell me this can't be done, I know
how to "substitute the text in the PostScript file before printing"
from the shell script, and will do it. I was just wondering if the
other way is possible, because it's much more elegant and almost
certainly runs faster.

                Thank you again,

                Marco Fioretti



Tue, 23 Dec 2003 20:47:40 GMT  
 Environment variables in postscript templates

Quote:

>What I meant is: can I modify the PostScript template so
>that, when **enscript** loads it, **before** sending anything
>to the printer, it loads a string from some shell environment
>variable, substitutes it on the fly in the template and goes?

That would require that enscript have code in it to process
environment variables. It probably doesn't, so that isn't really
viable. Perhaps you could store a master template, and use perl to
substitute the variables before running encript with the edited
template.

It is best to avoid looking at this as a PostScript programming
problem.
----------------------------------------

Visit http://www.*-*-*.com/ ,
PSAlter, psalters, tea, and small {*filter*} animals. And stuff.  



Tue, 23 Dec 2003 21:57:49 GMT  
 Environment variables in postscript templates

Quote:


> >What I meant is: can I modify the PostScript template so
> >that, when **enscript** loads it, **before** sending anything
> >to the printer, it loads a string from some shell environment
> >variable, substitutes it on the fly in the template and goes?

> That would require that enscript have code in it to process
> environment variables. It probably doesn't, so that isn't really
> viable. Perhaps you could store a master template, and use perl to
> substitute the variables before running encript with the edited
> template.

> It is best to avoid looking at this as a PostScript programming
> problem.

All right, no problem then. As mentioned before, I'm pretty good
at doing the Perl processing that you suggest, so I'll take that
way.

Thank you for explanations!

                Marco Fioretti



Tue, 23 Dec 2003 22:05:44 GMT  
 Environment variables in postscript templates

Quote:
Marco Fioretti wrote...
> Is it possible to "load" shell environment variables into
> a Postscript file?

Ghostscript can access environment variables using getenv
operator.

<string> getenv <string> true
                false

Regards,
Alex Cherepanov



Wed, 24 Dec 2003 01:32:30 GMT  
 Environment variables in postscript templates

Quote:

> Marco Fioretti wrote...

> > Is it possible to "load" shell environment variables into
> > a Postscript file?

> Ghostscript can access environment variables using getenv
> operator.

> <string> getenv <string> true
>                 false

> Regards,
> Alex Cherepanov

Can enscript do this too, i.e. understand getenv if it is found
within a PostScript template? Where can I find examples?

        TIA,
                        Marco Fioretti



Sat, 27 Dec 2003 14:58:29 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. environment variables: wshshell.environment or wshshell.expandenv ironmentstrings?

2. Creating and environment variable and using it in the same cmd window

3. Getting Environment Variables

4. Environment Variables

5. Using RedMon environment variables to get original Document Name

6. Environment Variable Reporting

7. Environment variables

8. Get Environment Variables from NT Server

9. Accessing Environment Variables from DHTML?

10. Environment Variables in Outlook agent

11. Client PC Environment Variables

12. Is it possible store a username as an environment variable

 

 
Powered by phpBB® Forum Software