home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 515.lha / BackTalk_v1.40 / rexx_examples / dialer.rexx < prev    next >
OS/2 REXX Batch file  |  1991-06-08  |  1KB  |  63 lines

  1.  /* Infinite dialing loop example */
  2.  
  3. /* 
  4.    A simple dialer example.  Will redial indefinitely 
  5.    until a CONNECT is made. 
  6. */
  7.  
  8. options results
  9. if ~show('l', "rexxsupport.library") then
  10.    addlib('rexxsupport.library',0,-30,0) 
  11.  
  12. address command "run work:telecom/backtalk"
  13. waitforport BT_REXX
  14. address BT_REXX
  15.  
  16. openport("BT_msg")
  17.  
  18. ONSTRING "CONNECT"
  19. OFFSTRING "BUSY"
  20.  
  21. call delay 150
  22.  
  23. number = "ATDT 555-1234"
  24. SEND number /* dial the number */
  25.  
  26. keepgoing = TRUE
  27.  
  28. do while keepgoing = TRUE
  29.    packet = getpkt("BT_msg")
  30.    do while packet = '00000000'x
  31.       call waitpkt("BT_msg")
  32.       packet = getpkt("BT_msg")
  33.    end
  34.  
  35.    arg0 = getarg(packet)
  36.    call reply(packet,0)
  37.    select
  38.       when arg0 = "OFF" then call doBusy
  39.       when arg0 = "MATCH" then call doConnect
  40.       otherwise nop
  41.    end
  42. end
  43.  
  44.   /* after you do connect the above loop will fall out */
  45.   /* so put the rest of your script here               */
  46.  
  47. RESET
  48. exit
  49.  
  50.  
  51. doBusy:
  52.    ONSTRING "CONNECT"
  53.    OFFSTRING "BUSY"
  54.    HANGUP
  55.    call delay 150  /* give time for HANGUP to take effect */
  56.    SEND number
  57.    return
  58.  
  59. doConnect:
  60.    OFFSTRING
  61.    keepgoing = FALSE
  62.    return
  63.