home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / cm17ce.zip / fcinst.EXE / client.cmd < prev    next >
OS/2 REXX Batch file  |  2000-01-18  |  4KB  |  175 lines

  1. /* CLIENT.CMD - Interactive REXX script for CM17A Comm Engine */
  2.  
  3. /*
  4.     Written by: Lone Peak Automation, LLC
  5.     Date: Jan. 15, 2000
  6.     This program requires the CM17A Comm Engine.
  7.     See http://home.att.net/~ASchw for more information.
  8.  
  9.     Important: The CM17A Comm Engine must be running and be connected
  10.                to the X10 FireCracker before using this script.
  11.  
  12. This is an example to show how to access the CM17A Comm Engine functions.
  13. */
  14.  
  15. /* Load CM17A Comm Engine Functions */
  16. call RxFuncAdd 'X10FLLoadFuncs', 'X10FLDLL', 'X10FLLoadFuncs'
  17. call X10FLLoadFuncs
  18.  
  19. /* Load the REXXUTIL.DLL */
  20. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  21. call SysLoadFuncs
  22.  
  23. pipename = '\PIPE\CM17ACE'
  24.  
  25. /* Note: If running over a network, precede the pipe name with the computer name as shown below. */
  26. /* pipename = '\\CLIENT527\PIPE\CM17ACE' */  /* note the _two_ backslashes preceding the computer name */
  27.  
  28. SAY pipename
  29.  
  30. rc = FCLOpenPipe(pipename)
  31. Say 'PipeOpen = ' || rc
  32.  
  33. IF rc = 0 then
  34.   DO
  35.     rc =  FCLPeekPipe('0')
  36.     Say 'PipePeek ' || rc
  37.     IF Right(rc, 1) = 3 then
  38.       SAY 'pipe connected'
  39.     else
  40.       DO
  41.        SAY 'pipe unavailable, close'
  42.        rc = FCLClosePipe('0')
  43.        Say 'PipeClose ' || rc
  44.       END
  45.   END
  46. ELSE
  47.   DO
  48.    SAY 'pipe not available'
  49.    rc = FCLClosePipe('0')
  50.    Say 'PipeClose ' || rc
  51.   END
  52.  
  53.  
  54. keyhit = ''
  55. DO FOREVER
  56.  
  57.    SAY "Press R to read; W to write, P to peek, O to Open, S to cloSe,"
  58.    SAY "Press C to connect; D to disconnect, Zx for COMx port, U to unload,"
  59.    SAY "M for status,"
  60.    SAY "+ to Show, - to Minimize,"
  61.    SAY "ID1 HCDC ON/OFF/DIM/BRI for direct commands,"
  62.    SAY "H for help, X to Exit"
  63.  
  64.    PARSE PULL keyhit
  65.  
  66.    SELECT
  67.    WHEN keyhit = 'x' then
  68.      LEAVE
  69.    WHEN keyhit = 'h' then
  70.      DO
  71.        SAY 'PipePeek status: '
  72.        SAY ' 1: the pipe is disconnected;'
  73.        SAY ' 2: the pipe is listening for a connection;'
  74.        SAY ' 3: the pipe is connected;'
  75.        SAY ' 4: the pipe is closing.'
  76.      END
  77.  
  78.       when POS('z', keyhit) = 1 | POS('Z', keyhit) = 1 then    /* COMx */
  79.         do
  80.          PortNum = Substr(keyhit, 2, 1)
  81.          temp = '}SETPORTCOM' || PortNum
  82.          rc = FCLWritePipe(temp)
  83.          keyhit = ""
  84.         end
  85.  
  86.       when keyhit = "c" | keyhit = "C" then    /* connect */
  87.         do
  88.          temp = '}CONNECT'
  89.          rc = FCLWritePipe(temp)
  90.          keyhit = ""
  91.         end
  92.       
  93.       when keyhit = "d" | keyhit = "D" then    /* disconnect  */
  94.         do
  95.           temp = '}DISCONNECT'
  96.           rc = FCLWritePipe(temp)
  97.           keyhit = ""
  98.         end
  99.  
  100.       when keyhit = "u" | keyhit = "U" then    /* unload  */
  101.         do
  102.           temp = '}CLOSE'
  103.           rc = FCLWritePipe(temp)
  104.           keyhit = ""
  105.         end
  106.  
  107.       when keyhit = "m" | keyhit = "M" then    /* status  */
  108.         do
  109.           temp = '}STATUS'
  110.           rc = FCLWritePipe(temp)
  111.           keyhit = ""
  112.           call SysSleep(2)      /* wait two seconds */
  113.           rc = FCLReadPipe('0')
  114.           SAY 'Status = >' || rc || '<'
  115.         end
  116.  
  117.       when keyhit = "+" then    /* restore  */
  118.         do
  119.           temp = '}SHOW'
  120.           rc = FCLWritePipe(temp)
  121.           keyhit = ""
  122.         end
  123.  
  124.       when keyhit = "-" THEN    /* min  */
  125.         do
  126.           temp = '}MINIMIZE'
  127.           rc = FCLWritePipe(temp)
  128.           keyhit = ""
  129.         end
  130.  
  131.       when POS('ID1', TRANSLATE(keyhit)) = 1 then    /* direct cmd  */
  132.         do
  133.           temp = '}' || keyhit
  134.           rc = FCLWritePipe(temp)
  135.           keyhit = ""
  136.         end
  137.  
  138.       WHEN keyhit = 'p' then
  139.         DO
  140.           rc = FCLPeekPipe('0')
  141.           Say 'PipePeek ' || rc
  142.         END
  143.       WHEN keyhit = 'r' then
  144.         DO
  145.           rc = FCLReadPipe('0')
  146.           SAY 'reading from pipe >' || rc || '<'
  147.         END
  148.       WHEN keyhit = 'w' then
  149.         DO
  150.           rc = FCLWritePipe('}ID1 A1 ON')
  151.           SAY 'writing to pipe ' || rc
  152.         END
  153.  
  154.       WHEN keyhit = 's' then
  155.         DO
  156.           rc = FCLClosePipe('0')
  157.           Say 'PipeClose ' || rc
  158.         END
  159.       WHEN keyhit = 'o' then
  160.         DO
  161.           rc = FCLOpenPipe(pipename)
  162.           Say 'PipeOpen = ' || rc
  163.        END
  164.  
  165.       OTHERWISE
  166.         NOP
  167.    END
  168. END
  169.  
  170. rc = FCLClosePipe('0')
  171. call X10FLDropFuncs
  172.  
  173. EXIT
  174.  
  175.