home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxlb.zip
/
SAMPLES
/
PS4UP.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-02-28
|
2KB
|
90 lines
/*****************************************************************************/
/* */
/* Print an ASCII file on a Postscript printer, 4 pages per sheet */
/* */
/* Requires Personal REXX or REXXLIB (dosdir, dosdel, & dosisfile functions) */
/* */
/* Command format: PS4UP <infile> <outfile> */
/* */
/*****************************************************************************/
signal on novalue
arg infile outfile .
if dosdir(infile) = '' then do
say "Input file '"infile"' not found."
exit
end
if outfile = '' then
outfile = 'PRN'
if dosisfile(outfile) then
call dosdel outfile
call pageinit
lines_per_page = 66
deltay = 72 * 5.5 / lines_per_page
xstart.1 = 0
ystart.1 = 72 * 5.75
xstart.2 = 72 * 8.5 / 2
ystart.2 = ystart.1
xstart.3 = 0
ystart.3 = 0
xstart.4 = xstart.2
ystart.4 = ystart.3
lineno = 0
quadrant = 1
showpage = 0
do while lines(infile)
line = linein(infile)
line = quote(line, "\()")
call print_line line
end
if showpage then
call lineout outfile, 'showpage'
call lineout outfile, 'restore'
call lineout outfile
call lineout infile
exit
/* print one line */
print_line: procedure expose lineno showpage lines_per_page deltay xstart.,
ystart. quadrant outfile
parse arg line
lineno = lineno + 1
showpage = 1
ypos = trunc((lines_per_page-lineno) * deltay + ystart.quadrant)
call lineout outfile, xstart.quadrant ypos 'moveto'
call lineout outfile, '('line') show'
if lineno < lines_per_page then
return
lineno = 0
if quadrant = 4 then do
call lineout outfile, 'showpage restore'
call pageinit
showpage = 0
end
quadrant = quadrant // 4 + 1
return
/* initialize page */
pageinit:
call lineout outfile, 'save 36 36 translate'
call lineout outfile, '.9375 .9091 scale'
call lineout outfile, '/Courier findfont 6 scalefont setfont'
return
/* insert escape characters */
quote: procedure
parse arg line, quotechars
x = 1
do forever
x = verify(line, quotechars, 'm', x)
if x = 0 then
leave
line = insert('\', line, x-1)
x = x + 2
end
return line