home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / REXXPRT2.ZIP / REXXPRNT.CMD
OS/2 REXX Batch file  |  1990-10-11  |  4KB  |  121 lines

  1. /* REXX print program for HP Laserjet printers 10-10-90 -msj */
  2.  
  3. /*      TRACE ?I        */
  4.  
  5. arg files
  6.  
  7. filedrv = filespec('drive',files)
  8. filepth = filespec('path',files)
  9.  
  10. if length(space(files, 0)) = 0 then
  11.     do
  12.     say ' '
  13.     say 'Specify a file name to print!'
  14.     exit
  15.     end
  16.  
  17. tempfile='prtlist$.$$$'
  18.  
  19. '@dir' files '/n >NUL'
  20.  
  21. if RC>0 then
  22.     do
  23.     say ' '
  24.     say 'Error getting file names!'
  25.     say 'Cancelling print request!'
  26.     exit
  27.     end
  28.  
  29. '@dir' files '/n | sort >' tempfile
  30.  
  31. call charout prn, D2C(27)||D2C(69)                             /* reset printer                      */
  32. call charout prn, D2C(27)||D2C(40)||D2C(115)||D2C(48)||D2C(84) /* set to LINEPRINTER font            */
  33. call charout prn, D2C(27)||D2C(40)||D2C(49)||D2C(48)||D2C(85)  /* set to 10U                         */
  34. call charout prn, D2C(27)||D2C(40)||D2C(115)||'16.6'||D2C(72)  /* set to compressed 17 char per inch */
  35. call charout prn, D2C(27)||D2C(40)||D2C(115)||'8.5'||D2C(86)   /* set to 8.5 point text              */
  36. call charout prn, D2C(27)||D2C(40)||D2C(115)||'48'||D2C(80)    /* set to fixed spacing               */
  37. call charout prn, D2C(27)||D2C(38)||D2C(108)||D2C(56)||D2C(68) /* set to 8 lpi                       */
  38. call lineout prn, ''
  39. call lineout , ''
  40.  
  41. printed=0
  42.  
  43. do x=1
  44.     if lines(tempfile)=0 then leave
  45.     direntry=linein(tempfile)
  46.     isdir=pos(" <DIR> ", direntry)
  47.     if isdir=0 then do
  48.         isfile=substr(direntry,3,1)
  49.         if isfile='-' then
  50.             do
  51.  
  52.             fileid=filedrv||filepth||substr(direntry,41)
  53.             call charout , D2C(27)||'[s'
  54.             
  55.             /* print file */
  56.  
  57.             pageno = 0
  58.             lineno = 74
  59.             borderline = copies('─',130)
  60.             do while lines(fileid) > 0
  61.                 if lineno = 74 then
  62.                     do
  63.                     if pageno \= 0 then
  64.                         do
  65.                         call lineout prn, ' '
  66.                         bottomline = overlay(' continued ──────',borderline,112)
  67.                         call lineout prn, bottomline
  68.                         pageline = center('- Page' pageno '-',130)
  69.                         call lineout prn, pageline
  70.                         call charout prn, D2C(12)
  71.                         end
  72.                      dateline = strip(right(time('C')  date('W')',' date('M') substr(date('S'),7,2)',' substr(date('S'),1,4),130),'t')
  73.                      headerline = overlay(dateline,pageline)
  74.                      headerline = overlay(fileid,headerline)
  75.                      call lineout prn, headerline
  76.                      call lineout prn, borderline
  77.                      call lineout prn, ''
  78.                      lineno = 1
  79.                      pageno = pageno + 1
  80.                      call charout , D2C(27)||'[u'
  81.                      call charout , 'Printing Page '||pageno||' of '||fileid
  82.                      end
  83.                 call lineout prn, '     '||linein(fileid)
  84.                 lineno = lineno + 1
  85.                 end
  86.             call lineout prn, ''
  87.             bottomline = overlay(' end-of-file ──────',borderline,110)
  88.             call lineout prn, bottomline
  89.             pageline = center('- Page' pageno '-',130)
  90.             call lineout prn, pageline
  91.             call lineout fileid
  92.             call lineout , ''
  93.             printed = printed + 1
  94.             call charout prn, D2C(12)
  95.             end
  96.             /* done printing current file */
  97.         end
  98.     end
  99.  
  100. /* reset and close printer */
  101.  
  102. call charout prn, D2C(27)||D2C(69)
  103. call lineout prn
  104.  
  105. call lineout , ''
  106. pageline = printed||' file(s) printed.'
  107. call charout , pageline
  108. call lineout , ''
  109.  
  110. /* cleanup temporary file */
  111.  
  112. call stream tempfile, "C", "close"
  113.  
  114. "@del" tempfile
  115.  
  116.  
  117.  
  118. /*         FIDONET:  Matt Johnson @1:376/32.0                    */
  119. /*       or USENET:  uunet!usceast!uscacm!32!Matt.Johnson        */
  120.  
  121.