scairns@citib.com (Scott Cairns) (05/08/91)
Now that I've established the proper forum for postscript questions (thanks to the 200,000 replies to prior question)... We're running SunOS 4.1 with OpenLook 2.0 window manager. I want to modify the OpenLook init.ps file so that I can check the value of an environment variable (in postscript language of course) and take appropriate action. Something along the lines of: (1) get value of env variable (e.g. LOGO) (2) if (LOGO == 1) run some post-script file else continue on Not knowing post-script and not finding any sample post-script code in the ~openwin directory that does something like this, I was hoping for some suggestions... -- +-----------------------------------------------------------------+ | Scott Cairns email: scairns@bank.citib.com | | One Court Square / 27th Floor phone: (718) 248-5366 | | Long Island City, NY 11120 fax: (718) 248-6855 |
gaudreau@juggler.East.Sun.COM (Joe Gaudreau (Dances with PostScript)) (05/18/91)
scairns@citib.com (Scott Cairns) writes: =We're running SunOS 4.1 with OpenLook 2.0 window manager. = =I want to modify the OpenLook init.ps file so that I can =check the value of an environment variable (in postscript =language of course) and take appropriate action. = =Something along the lines of: = =(1) get value of env variable (e.g. LOGO) = =(2) if (LOGO == 1) = = run some post-script file = = else = = continue on = =Not knowing post-script and not finding any sample post-script =code in the ~openwin directory that does something like this, I =was hoping for some suggestions... Piece of PS (actually NeWS): (LOGO) getenv 1 eq {%ifelse (somefilename) run } if %continue on... Is this what you wanted? Joe -=- -- /Joe-Gaudreau {ps-hacker c[++]^2 juggler add add nice-guy mul} bind def Fone: (508)671-0461 INet: gaudreau@East.Sun.Com UUCP: sun!suneast!gaudreau Snail: Sun Microsystems Inc - BDC, 2 Federal St, Billerica, MA 01821 The opinions I juggle may not be mine, but they aren't my employer's either.
flar@bendenweyr.Eng.Sun.COM (Jim Graham) (05/18/91)
This really belongs in comp.windows.news... gaudreau@juggler.East.Sun.COM (Joe Gaudreau (Dances with PostScript)) writes: |> scairns@citib.com (Scott Cairns) writes: |> =We're running SunOS 4.1 with OpenLook 2.0 window manager. |> = |> =I want to modify the OpenLook init.ps file so that I can |> =check the value of an environment variable (in postscript |> =language of course) and take appropriate action. |> = |> =Something along the lines of: |> = |> =(1) get value of env variable (e.g. LOGO) |> = |> =(2) if (LOGO == 1) |> = |> = run some post-script file |> = |> = else |> = |> = continue on |> = |> =Not knowing post-script and not finding any sample post-script |> =code in the ~openwin directory that does something like this, I |> =was hoping for some suggestions... |> Piece of PS (actually NeWS): |> |> (LOGO) getenv 1 eq {%ifelse |> (somefilename) run |> } if |> |> %continue on... |> |> Is this what you wanted? Since the getenv operator returns an error if the environment variable doesn't exist, ?getenv should be used instead to provide a default. Also, getenv returns a string, so a cvi should be performed or a string compare should be done: (LOGO) (0) ?getenv (1) eq { (somefilename) run } if should work. ...jim