#Creating Delays
2 messages in this thread
I am trying to get a NEC 890 to switch between Postscript and HP Laserjet mode
and NEC has given me control sequences to do this but it requires waiting 2
seconds before gibing the CTRL-D. They say you can create the delay with
appropriate Postscript programming but have not been able to get me the code.
Since my printer is on a network server, it is imperitive that I get this done
as users have no reliable way of creating the delay.
Does anyone know the Postscript code that will do this?
Here's a PostScript procedure that will do what you need:
/Wait
{ 1000 mul usertime add /EndTime exch def
{ usertime EndTime ge
{exit}
if
} loop
} def
The "usertime" operator returns an integer, which increases by 1 each
millisecond during execution of a PostScript job. It's actual value is
arbitrary, but its incrementing isn't.
So, we put the number of seconds we want to wait on the stack and call the
procedure, "Wait". It multiplies the number of seconds by 1000 (since
usertime increments by thousands of a second), and adds it to the current
usertime to create EndTime. Then we just go into a loop that checks to see
when usertime becomes greater or equal to EndTime, and when it does, it
exits.
After the above definition, to wait 2 seconds, your program would need to
look like this:
2 Wait
Hope this works for you.