home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
REXXPRT2.ZIP
/
REXXPRNT.CMD
Wrap
OS/2 REXX Batch file
|
1990-10-11
|
4KB
|
121 lines
/* REXX print program for HP Laserjet printers 10-10-90 -msj */
/* TRACE ?I */
arg files
filedrv = filespec('drive',files)
filepth = filespec('path',files)
if length(space(files, 0)) = 0 then
do
say ' '
say 'Specify a file name to print!'
exit
end
tempfile='prtlist$.$$$'
'@dir' files '/n >NUL'
if RC>0 then
do
say ' '
say 'Error getting file names!'
say 'Cancelling print request!'
exit
end
'@dir' files '/n | sort >' tempfile
call charout prn, D2C(27)||D2C(69) /* reset printer */
call charout prn, D2C(27)||D2C(40)||D2C(115)||D2C(48)||D2C(84) /* set to LINEPRINTER font */
call charout prn, D2C(27)||D2C(40)||D2C(49)||D2C(48)||D2C(85) /* set to 10U */
call charout prn, D2C(27)||D2C(40)||D2C(115)||'16.6'||D2C(72) /* set to compressed 17 char per inch */
call charout prn, D2C(27)||D2C(40)||D2C(115)||'8.5'||D2C(86) /* set to 8.5 point text */
call charout prn, D2C(27)||D2C(40)||D2C(115)||'48'||D2C(80) /* set to fixed spacing */
call charout prn, D2C(27)||D2C(38)||D2C(108)||D2C(56)||D2C(68) /* set to 8 lpi */
call lineout prn, ''
call lineout , ''
printed=0
do x=1
if lines(tempfile)=0 then leave
direntry=linein(tempfile)
isdir=pos(" <DIR> ", direntry)
if isdir=0 then do
isfile=substr(direntry,3,1)
if isfile='-' then
do
fileid=filedrv||filepth||substr(direntry,41)
call charout , D2C(27)||'[s'
/* print file */
pageno = 0
lineno = 74
borderline = copies('─',130)
do while lines(fileid) > 0
if lineno = 74 then
do
if pageno \= 0 then
do
call lineout prn, ' '
bottomline = overlay(' continued ──────',borderline,112)
call lineout prn, bottomline
pageline = center('- Page' pageno '-',130)
call lineout prn, pageline
call charout prn, D2C(12)
end
dateline = strip(right(time('C') date('W')',' date('M') substr(date('S'),7,2)',' substr(date('S'),1,4),130),'t')
headerline = overlay(dateline,pageline)
headerline = overlay(fileid,headerline)
call lineout prn, headerline
call lineout prn, borderline
call lineout prn, ''
lineno = 1
pageno = pageno + 1
call charout , D2C(27)||'[u'
call charout , 'Printing Page '||pageno||' of '||fileid
end
call lineout prn, ' '||linein(fileid)
lineno = lineno + 1
end
call lineout prn, ''
bottomline = overlay(' end-of-file ──────',borderline,110)
call lineout prn, bottomline
pageline = center('- Page' pageno '-',130)
call lineout prn, pageline
call lineout fileid
call lineout , ''
printed = printed + 1
call charout prn, D2C(12)
end
/* done printing current file */
end
end
/* reset and close printer */
call charout prn, D2C(27)||D2C(69)
call lineout prn
call lineout , ''
pageline = printed||' file(s) printed.'
call charout , pageline
call lineout , ''
/* cleanup temporary file */
call stream tempfile, "C", "close"
"@del" tempfile
/* FIDONET: Matt Johnson @1:376/32.0 */
/* or USENET: uunet!usceast!uscacm!32!Matt.Johnson */