home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 January / SOFM_Jan1996.bin / pc / os2 / zoc / install.fil / SCRIPT / ZOCEVENT.CMD < prev   
Encoding:
Text File  |  1995-11-25  |  4.1 KB  |  112 lines

  1. /*********************************************************************** 
  2.  
  3.    THIS REXX PROGRAM IS FOR USE WITH ZOC AND FAXWORKS 
  4.  
  5.  
  6.  - HOW TO USE --------------------------------------------------------
  7.  
  8.    Below these instructions is a line containing an EXIT command.  
  9.  
  10.    Removing this line will (probably) turn off FaxWorks' receive mode 
  11.    when ZOC is started and will turn it back on when ZOC is closed.
  12.  
  13.    If it doesn't work, it is probably time for you to deal with REXX 
  14.    (if you didn't already).
  15.  
  16.  
  17.  - CALL-ARGUMENTS -----------------------------------------------------
  18.  
  19.    It is called with the following arguments:
  20.        When ZOC starts:            OPEN 
  21.        Before a device is opened:  DEVOPEN '<DeviceName>' '<DeviceOpts>'
  22.        After a device was closed:  DEVCLOSE '<DeviceName>' 
  23.        When ZOC is exits:          CLOSE
  24.  
  25.    The DeviceName is the same as it appears in ZOC (eg. SERIAL/MODEM).
  26.  
  27.    The DeviceOpts are undocumented, so you need a bit of experimenting
  28.    with them (see debugging).  However, since they are probably only 
  29.    used to determine the com port, here is how to parse the MODEM/SERIAL 
  30.    options:
  31.  
  32.     /+ if serial, get com port +/
  33.     if Event="DEVOPEN" & DeviceName="SERIAL/MODEM" then do
  34.         parse value DeviceOpts with "[" id "]" serport ":" baud "-" opts "|" 
  35.         serport= translate(serport)  /+ uppercase +/
  36.         call lineout "zocevent.trc", "OPEN OF "serport" DETECTED"
  37.     end if
  38.  
  39.  
  40.  
  41.  - PROGRAMMING --------------------------------------------------------
  42.  
  43.    None of the ZOC commands work here (because ZOCEVENT.CMD is called 
  44.    before initialization and after cleanup of ZOC subsystems).
  45.  
  46.  
  47.  - DEBUGGING ----------------------------------------------------------
  48.  
  49.    Unfortunately you can't use SAY or TRACE, but writing debugging 
  50.    information to a file with 'call lineout ...' might help:
  51.        call lineout "zocevent.trc", event "#" DeviceName "#" DeviceOpts
  52.  
  53.    Additionally, for testing purposes you can call the script from 
  54.    the command line with the same parameters that ZOC would use:
  55.        C:\ZOC> SCRIPT\ZOCEVENT "OPENDEV" "SERIAL/MODEM" "[1]COM3:38400-8N1|"
  56.  
  57. ***********************************************************************/
  58.  
  59.  
  60. /**********************************************************************/
  61. /* The line below exits at once -- remove it to make it all work      */
  62. /**********************************************************************/
  63.  
  64. exit  /* >>>>>>>  to make it all work delete this line <<<<<<<<<<< */
  65.  
  66.  
  67.  
  68. /**********************************************************************/
  69. /* Parse the command line arguments (as described above)              */
  70. /**********************************************************************/
  71. parse arg Event " '" DeviceName "'" "'" DeviceOpts "'"
  72.  
  73.  
  74.  
  75. /**********************************************************************/
  76. /* Find out where FaxWorks is installed                               */
  77. /**********************************************************************/
  78. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  79. call SysLoadFuncs
  80. faxdir= SysIni("USER", "Fax", "ExeDir")
  81. faxdir= left(faxdir,length(faxdir)-1)  /* remove trailing nul */
  82. faxrcv= faxdir||"fxrcv"
  83.  
  84.  
  85. /**********************************************************************/
  86. /* Here comes the big action ...                                      */
  87. /**********************************************************************/
  88. select 
  89.     /* if ZOC was started *********************************************/
  90.     when Event="OPEN" then do
  91.         faxrcv "-off"
  92.     end /* if */
  93.  
  94.     /* if a ZOC-device will be opened **********************************/
  95.     when Event="DEVOPEN" then do
  96.         /* nothing yet */
  97.     end /* if */
  98.  
  99.     /* if a ZOC-device was closed **************************************/
  100.     when Event="DEVCLOSE" then do
  101.         /* nothing yet */
  102.     end /* if */
  103.  
  104.     /* if ZOC was closed ***********************************************/
  105.     when Event="CLOSE" then do    /* if ZOC closed */
  106.         faxrcv "-on"
  107.     end /* if */
  108.  
  109. end /* select */
  110.  
  111. exit
  112.