home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / autozoc.zip / OS2NEW.REX < prev    next >
OS/2 REXX Batch file  |  1995-11-19  |  3KB  |  131 lines

  1. /* REXX script to automatically call BBS, log on, download OS2NEW.ZIP, then log off. */
  2.  
  3. /* clear screen  */
  4. 'CLS'
  5.  
  6. /* set variables */
  7.  
  8. USER_NAME="XXXXX XXXXXXX"       /* your name as registered with the BBS (put in quotes) */
  9. PASSWORD="XXXX"                 /* your password as registered with the BBS (put in quotes) */
  10. BBS_NUM="#-###-###-####"        /* the BBS phone number (put in quotes) */
  11. MIN_SPEED=#####                 /* minimum connect speed you'll accept (NO QUOTES) */
  12. MAX_ATTEMPTS=#                  /* maximum number of times to retry the call (NO QUOTES) */
  13.  
  14. DO CALL_BBS=1 TO MAX_ATTEMPTS
  15.  
  16.   /* clear screen */
  17.   'CLS'
  18.  
  19.   /* initialize modem */
  20.   SEND 'ATZ1^M'
  21.   DELAY 1
  22.  
  23.   SAY "Attempt # " CALL_BBS 
  24.  
  25.   SAY "Calling the OS/2 Shareware BBS to download OS2NEW.ZIP.  Dialing...." BBS_NUM
  26.  
  27.   'TIMEOUT 60'
  28.  
  29.   DIAL BBS_NUM '^IOS/2 Shareware'
  30.  
  31.       /* let's see what kind of response we get */
  32.       DO RESULT_TYPE=1 TO 6
  33.  
  34.          /* receive next line of text */
  35.          'GETLINE'
  36.  
  37.          /* if no answer, try again (leave loop) */
  38.          IF RC=640 THEN 
  39.          DO
  40.             HANGUP
  41.             LEAVE RESULT_TYPE
  42.          END
  43.          
  44.          /* if BUSY was received, try again (leave loop) */
  45.          IF ZOCLASTLINE()=="BUSY" THEN
  46.          DO
  47.         DELAY 1
  48.         SAY "The line is busy.  We'll try again."
  49.             LEAVE RESULT_TYPE
  50.          END
  51.  
  52.          /* if NO DIAL TONE was received, end with error message */
  53.          IF ZOCLASTLINE()=="NO DIAL TONE" THEN 
  54.          DO
  55.         DELAY 1
  56.             SAY "Possible hardware or software trouble.  Aborting attempt."
  57.             EXIT
  58.          END
  59.  
  60.          /* if NO CARRIER was received, end with error message */
  61.          IF ZOCLASTLINE()=="NO CARRIER" THEN 
  62.          DO
  63.             HANGUP
  64.             SAY "Possible dialing error.  Check phone number."
  65.             EXIT
  66.          END
  67.  
  68.          /* determine the connect speed */
  69.          DO B=9 TO 15
  70.            IF SUBSTR(ZOCLASTLINE(),B,1)="/" THEN
  71.            DO 
  72.               B=B-9
  73.               LEAVE B
  74.            END
  75.          END B
  76.          SPEED=SUBSTR(ZOCLASTLINE(),9,B)
  77.          IF SPEED<MIN_SPEED THEN 
  78.          DO
  79.             HANGUP
  80.             ASK '"Connect speed is too slow!"' '"Do you want to try again?"'
  81.             IF ZOCRESULT()="##CANCEL##" THEN
  82.             DO              
  83.                EXIT
  84.             END
  85.             ELSE LEAVE RESULT_TYPE
  86.          END
  87.          ELSE LEAVE CALL_BBS
  88.  
  89.       END RESULT_TYPE
  90.  
  91.       NOTIFY "Pausing for 30 seconds."
  92.       DELAY 30
  93.  
  94. END CALL_BBS
  95.  
  96. IF CALL_BBS=MAX_ATTEMPTS+1 THEN
  97. DO
  98.    NOTIFY "Can't get through now.....try again later."
  99.    'CLS'
  100.    EXIT
  101. END
  102.  
  103. WAIT 'your name:'
  104. SEND USER_NAME '^M'
  105.  
  106. WAIT SUBSTR(USER_NAME,LENGTH(USER_NAME)-2,3)' [Y,n]?'
  107. SEND 'y^M'
  108.  
  109. WAIT 'Password:'
  110. SEND PASSWORD '^M'
  111.  
  112. WAIT 'o continue'
  113. SEND '^M'
  114.  
  115. WAIT 'e [Y,n,=]?'
  116. SEND 'N^M'
  117.  
  118. WAIT 'Select: '
  119. SEND 'F^M'
  120.  
  121. WAIT 'Select: '
  122. SEND 'D^M'
  123.  
  124. WAIT 'load (#1):'
  125. SEND 'OS2NEW.ZIP^M'
  126.  
  127. WAIT 'load (#2):'
  128. SEND '/G^M'
  129.  
  130. WAIT '<esc> to abort:'
  131. SEND '^M'