home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
pwrprt.zip
/
PWRPRT.CMD
next >
Wrap
OS/2 REXX Batch file
|
1994-12-18
|
2KB
|
67 lines
/*-----------------------------------------------------------+
| Print Power v.10
|
| Monitors the queue for print jobs, powers up the printer
| and releases the jobs. Shuts printer off when there are no
| more jobs.
|
| (C)opyright 1994, Arthur F. Tyde III
|
+-----------------------------------------------------------*/
parse arg qname
parse value '' with parta partb qdata
warmup=60
offdelay=300
interval=30
printmodule=parta partb
logfile='C:\PWRPRT\PWRPRT.LOG'
if qname<>'' then do
'@NET PRINT' qname '/HOLD'
do forever
if check_q(qname)>0 then do
say '-> Switching printer ON.'
call lineout logfile,date() time()', powering printer ON'
call lineout logfile,qdata
call x10 printmodule 'ON'
say ' Printer warmup takes' warmup 'seconds.'
call syssleep warmup
say ' Releasing jobs in' qname 'queue.'
'@NET PRINT' qname '/RELEASE'
do until check_q(qname)=0 /* wait for queue to drain */
call syssleep interval
end
say '-> Holding' qname 'queue.'
'@NET PRINT' qname '/HOLD'
call syssleep offdelay
say '-> Switching printer OFF.'
call lineout logfile,date() time()', powering printer OFF'
call lineout logfile
call x10 printmodule 'OFF'
end
else do
say '-> Nothing in' qname'.'
end
call syssleep interval
end
end
else do
say
say 'Syntax: PWRPRT X10-MODULE-LETTER X10-MODULE-NUMBER QUEUENAME'
end
exit
check_q:
procedure expose qdata
parse arg qname
qdata=''
'@NET PRINT' qname '| RXQUEUE'
do i=1 to queued()
parse pull info
qdata=qdata info
end
parse value qdata with 'jobs' -10 jobs .
return jobs