home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / zoc201.zip / INSTALL.FIL / SCRIPT / RXSAMPLE / MANUAL / ZOCLASTL.RX < prev    next >
Text File  |  1994-11-03  |  1KB  |  54 lines

  1. /* REXX script to dial (and retry) a phone number */
  2.  
  3. /* Ask user what number should be dialled */
  4. 'ASK "What number shall I dial?"'
  5.  
  6. /* dial the number if it was non empty and if user 
  7.    did not press the ESC key */
  8.  
  9. IF ZOCRESULT()\="" & ZOCRESULT()\="##CANCEL##" THEN 
  10. DO 
  11.    /* redial 5 times max. */
  12.    DO TRY=1 to 5  
  13.  
  14.       SAY "Try #" TRY 
  15.  
  16.       'DIAL "' || ZOCRESULT() || '"'
  17.  
  18.       /* wait for a reply within 60 seconds */
  19.       'TIMEOUT 60' 
  20.  
  21.       /* scan the next 6 lines for something interesting */
  22.       DO LINE=1 TO 6
  23.          /* receive next line of text */
  24.          'GETLINE'
  25.  
  26.          /* if timed out, end script with error */
  27.          IF RC=640 THEN SIGNAL ERROR
  28.  
  29.          /* if BUSY was received, try again (leave inner loop) */
  30.          IF ZOCLASTLINE()="BUSY" THEN LEAVE LINE
  31.  
  32.          /* if NO CARRIER was received, end with error */
  33.          IF ZOCLASTLINE()="NO CARRIER" THEN 
  34.          DO
  35.             SAY "Error!"
  36.             LEAVE TRY    /* leave outer loop */
  37.          END
  38.  
  39.  
  40.          /* if CARRIER or CONNECT was received, everything's ok */
  41.          IF LEFT(ZOCLASTLINE(),7)="CONNECT" | ,
  42.              LEFT(ZOCLASTLINE(),7)="CARRIER" THEN 
  43.          DO 
  44.             'BEEP 3'  /* page user */
  45.             LEAVE TRY    /* leave outer loop */
  46.          END 
  47.  
  48.       END LINE
  49.  
  50.       'DELAY 30' /* wait 30 seconds to dial next */
  51.  
  52.    END TRY 
  53. END /* IF */
  54.