home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 January / CHIPCD1_98.iso / software / tipsy / zoc / install.fil / SCRIPT / RXSAMPLE / MANUAL / ZOCLASTL.ZRX < prev    next >
Text File  |  1996-09-16  |  1KB  |  51 lines

  1. /* REXX script to dial (and retry) a phone number */
  2.  
  3. /* Ask user what number should be dialled */
  4. number= ZocAsk("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 number\="" & number\="##CANCEL##" THEN DO 
  10.    /* redial 5 times max. */
  11.    DO TRY=1 TO 5  
  12.  
  13.       SAY "Try #" TRY 
  14.  
  15.       CALL ZocDial number
  16.  
  17.       /* wait for CONNECT within 60 seconds */
  18.       CALL ZocTimeout 60 
  19.  
  20.       /* scan the next 6 lines for something interesting */
  21.       DO LINE=1 TO 6
  22.          /* receive next line of text */
  23.          timeout= ZocGetLine()
  24.  
  25.          /* if timed out, end script with error */
  26.          IF timeout=640 THEN SIGNAL ERROR
  27.  
  28.          /* if BUSY was received, try again (leave inner loop) */
  29.          IF ZOCLASTLINE()="BUSY" THEN LEAVE LINE
  30.  
  31.          /* if NO CARRIER was received, end with error */
  32.          IF ZOCLASTLINE()="NO CARRIER" THEN DO
  33.             SAY "Error!"
  34.             LEAVE TRY    /* leave outer loop (DO TRY=1 ...) */
  35.          END
  36.  
  37.          /* if CARRIER or CONNECT was received, everythings ok */
  38.          IF LEFT(ZOCLASTLINE(),7)="CONNECT" | ,
  39.              LEFT(ZOCLASTLINE(),7)="CARRIER" THEN DO 
  40.             CALL ZocBeep 3  /* page user */
  41.             LEAVE TRY    /* leave outer loop */
  42.          END 
  43.  
  44.       END LINE
  45.  
  46.       CALL ZOCDELAY 30 /* wait 30 seconds to dial next */
  47.  
  48.    END TRY 
  49.  
  50. END /* IF */
  51.