home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mr2i160.zip / FAXRCV.CMD < prev    next >
OS/2 REXX Batch file  |  1996-09-08  |  2KB  |  100 lines

  1. /*
  2.     MR/2 ICE - RCVFAX.CMD
  3.  
  4.     Copyright (c) 1996, Nick Knight
  5.     All Rights Reserved.
  6.  
  7.     Author:     Nick Knight
  8.     Created:    08/10/96
  9.     Usage:        rcvfax MessageFile
  10.     Purpose:    To interface with PMFax v3.0 or better and pass
  11.                 it faxes transported via email.
  12.     US Mail:    Nick Knight, PO Box 22366, Beachwood, Ohio 44122
  13.     Fidonet:    1:157/2
  14.     Internet:    nick@secant.com
  15.     Compuserve: 76066,1240
  16.     BBS:        Private messages on Nerd's Nook (216) 356-1772 or 1872
  17. */
  18.  
  19.  
  20. /* 
  21.     If FxRcv is not in your path, you can simply supply the path to it
  22.     below.    Example would be PMFaxPath='f:\pmfax\'.  INCLUDE the closing
  23.     backslash, please!!
  24. */      
  25.  
  26. PMFaxPath=''
  27.  
  28.  
  29. parse arg filename
  30.  
  31. say ' '
  32. say 'MR/2 ICE Email-to-Fax script v1.0'
  33. say 'Copyright (c) 1996, Nick Knight'
  34. say 'All Rights Reserved.'
  35. say ' '
  36.  
  37. logfile = 'detach.$$$'
  38. from = ''
  39. subject = ''
  40.  
  41. '@echo off'
  42.  
  43. 'del 'logfile' >nul'
  44. 'mr2i /D'filename logfile
  45.  
  46.  
  47. /*
  48.     This section walks through the incoming message header, collecting
  49.     the pertainent header values into save strings.  There is a little
  50.     bit of a trick here, as we ALSO try to see if the first line of the
  51.     message contains the command.
  52. */
  53.  
  54. fHeader = 1
  55. ctr = 0
  56.  
  57. status = stream(filename,'c','open read')
  58. do while ((ctr < 100) & (lines(filename) > 0))
  59.     iline = linein(filename)
  60.     Parse VALUE iline with tag ': ' value
  61.     Parse UPPER VALUE iline with tag ': '
  62.     
  63.     if (tag == 'FROM') then
  64.         from = value
  65.     else if (tag == 'SUBJECT') then
  66.         subject = value
  67.  
  68.     if (Length(iline) == 0) then
  69.         fHeader = 0
  70.  
  71.     if Length(from) > 0 then
  72.         if Length(subject) > 0 then
  73.             ctr = 200;
  74.     
  75.     ctr = ctr + 1
  76. end
  77.  
  78. status = stream(filename,'c','close')
  79.  
  80. say 'Fax from' from 'regarding' subject
  81.  
  82. /* Call FxRcv for each dettached file listed in the log */
  83.  
  84. status = stream(logfile,'c','open read')
  85. do while (lines(logfile) > 0)
  86.     iline = linein(logfile)
  87.     if (Length(iline) > 2) then do
  88.         SAY PMFaxPath||'FxRcv -rcvd' iline '"'from'"' '"'subject'"'
  89.         PMFaxPath||'FxRcv -rcvd' iline '"'from'"' '"'subject'"'
  90.         'del' iline
  91.     end
  92. end
  93.  
  94. status = stream(logfile,'c','close')
  95.  
  96. 'del' logfile '>nul'
  97.  
  98. return 0
  99.  
  100.