home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
REXPRT21.ZIP
/
REXXPRNT.CMD
Wrap
OS/2 REXX Batch file
|
1991-10-04
|
8KB
|
210 lines
/* REXX print program for HP Laserjet printers 10-10-90 -msj */
/* */
/* */
/* MODIFIED ON 10/03/91 TO CHECK FOR A '012' CODE IN A */
/* FILE AND PROPERLY HANDLE IT. BOB WALTERS */
/* */
/* */
/* TRACE ?I */
arg files
filedrv = filespec('drive',files)
filepth = filespec('path',files)
SAY ' '
SAY 'REXX PRINT PROGRAM FOR HP LASERJET PRINTERS'
SAY ' '
SAY ' PRINTS 125 COLUMNS AND 74 LINES ON A '
SAY ' 8 1/2 BY 11 INCH FORM. '
SAY ' '
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(49)||D2C(69) /* set to NO TOP MARGIN */
call charout prn, D2C(27)||D2C(38)||D2C(108)||D2C(56)||D2C(68) /* set to 8 lpi */
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, ''
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 FINDIT
call lineout prn, ' '||LINEWORK
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
exit
FINDIT:
LINEWORK = LINEIN(FILEID)
PRTPOS = 0
FOUND012 = 0
IF LENGTH(LINEWORK) = 0
THEN RETURN
PRTPOS = POS(D2C(012),LINEWORK)
IF PRTPOS > 0
THEN DO
LINENO = 73
FOUND012 = 1
IF PRTPOS = 1
THEN DO
LINEWORK = SUBSTR(LINEWORK,PRTPOS+1)||' '
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)
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, ''
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
IF PRTPOS > 1
THEN DO
LINEWRK2 = LINEWORK
LINEWORK = SUBSTR(LINEWORK,1,PRTPOS-1)||' '
IF PRTPOS < LENGTH(LINEWRK2)
THEN DO
call lineout prn, ' '||LINEWORK
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)
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, ''
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
LINEWORK = SUBSTR(LINEWRK2,PRTPOS+1)||' '
END
END
END
RETURN
/* FIDONET: Matt Johnson @1:376/32.0 */
/* or USENET: uunet!usceast!uscacm!32!Matt.Johnson */
/* */
/* */
/* */
/* */
/* MODIFIED FOR PROPER CHECKING OF A '012' CODE WITHIN */
/* A FILE AND WHEN DETECTED HANDLE IT WITH THE PROPER */
/* END-OF-PAGE ROUTINE. THIS CHANGE HAS BEEN TESTED ON */
/* OS/2 1.3 EXTENDED EDITION-CSD LEVEL WR05016 AND AN */
/* OKIDATA OL400 LASER PRINTER - USING HP-II EMULATION. */
/* BOB WALTERS 10/03/91 */
/* */