home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / pmcom233.zip / SAMPLE.CMD < prev    next >
OS/2 REXX Batch file  |  1996-01-02  |  3KB  |  73 lines

  1. /* Sample Script*/
  2. /* This script will allow you to log on to Compu-Plane once you change    */
  3. /* the strings stored in the varibles name and pass. Enter the sample.scr */
  4. /* name for the script name of the Compu-Plane phone number, and change   */
  5. /* the name in the shell() function to the path and filename of this file.*/
  6.  
  7. Call RxFuncadd "init_dll","RxPmcomm","init_dll"
  8.  
  9. /* This function registers the init_dll function with REXX. The init_dll*/
  10. /* function will register the rest of the functions in the rxpmcomm.dll. */
  11.  
  12. Parse arg port portname screen_handle dde_output dde_input semaphore
  13.  
  14. /*These are the values that Pmcomm passes on the command line to and */
  15. /* external program. These values can then be used in different REXX */
  16. /* functions along with the rxpmcomm.dll functions. Following is the */
  17. /* description of each value:                                        */
  18. /*      port = The handle of the open com port in Pmcomm             */
  19. /*      portname = The name of the opened com port ie.. COM1         */
  20. /*      screen_handle = Anything written to the handle will be printed */
  21. /*                      on the Pmcomm screen.                        */
  22. /*     dde_output = This must be passed to any file transfer function. It*/
  23. /*            allows the rxpmcomm.dll function to communicate with   */
  24. /*            Pmcomm.                                                */
  25. /*     dde_input = This must be passed to any file transfer function. It*/
  26. /*            allows the rxpmcomm.dll function to communicate with   */
  27. /*            Pmcomm.                                                */
  28.  
  29. Call init_dll
  30.  
  31. /* Required before any other rxpmcomm.dll functions are called.      */
  32.  
  33. /* Setup variables                         */
  34. name = 'first;name'   /* where first is your first name and last is*/
  35. pass = 'password'     /* your last name and password is you password.*/
  36. cr   = '0d'x
  37.  
  38. Call read_timeout '20000',port
  39.  
  40. /* This sets the read timeout for 20 seconds. This is used in the    */
  41. /* wait_for, wait_fore, and the Get_ch functions.                    */
  42.  
  43. Say 'Waiting for first name ...'
  44.  
  45. /* This will be printed on the REXX screen. */
  46.  
  47. Do Forever
  48.    Call Wait_fore 'name','password','continue?',' ? ','[N]o, [C]',port,screen_handle
  49.  
  50. /* This call will echo all characters to the Pmcomm screen that come    */
  51. /* from the open com port. When one of the strings are matched the      */
  52. /* function will return the index of the matched string in the variable */
  53. /* result. For example if it receives the string password then result   */
  54. /* will be equal to 2. If the functions waits longer then the read timeout */
  55. /* value then result will be equal to 0.                                */
  56.  
  57.    match = result
  58.    Select
  59.      When match=1 then
  60.        Do
  61.          Call Put_s name||cr,port
  62.          Say 'Waiting for password ...'
  63.        End
  64.      When match=2 then Call Put_s pass||cr,port
  65.      When match=3 then Call Put_s cr,port
  66.      When match=4 then Exit
  67.      When match=5 then Call Put_s 'n',port
  68.    Otherwise nop
  69.    End
  70. End
  71. Say 'Script ended   -' date() time()
  72. Exit
  73.