home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / zow311.exe / INSTALL.FIL / SCRIPT / RXSAMPLE / TUTORIAL / 99_FIDO.ZRX < prev   
Text File  |  1996-08-26  |  4KB  |  126 lines

  1. /* REXX 
  2. **
  3. **  This is a non-functional skeleton for creating an autologin 
  4. **  script. However you might not need it, since simple autologins 
  5. **  can be achieved without script programming using the autologin 
  6. **  feature of the phone book.
  7. **
  8. **  Scenario:
  9. **    Let's assume Zaphod Beeblebrox uses the Megadodo bbs on Ursa 
  10. **    Minor Beta to download new messages and upload the replys that 
  11. **    he wrote offline. 
  12. **    This script calls the bbs and eventually tries again until it
  13. **    gets a CONNECT. Then it goes to the main menu where it downloads
  14. **    a new mail packet and, if available, uploads Zaphod's replies.
  15. **
  16. */
  17.  
  18.  
  19. /* Prevent users from accidently dialling long distance to Ursa Minor Beta */
  20.  
  21. CALL ZocMsgBox "This is a sample file.  You should check it's source code"
  22.  
  23. really= ""
  24. yesno= ""
  25. DO UNTIL yesno="##NO##"
  26.     yesno= ZocMsgBox("Are you "||really||" sure that you want to make a "||,
  27.                     "call across the universe?", 2)
  28.     IF yesno="##YES##" THEN DO 
  29.         really= really||" really"
  30.     END
  31. END
  32. SIGNAL finish
  33.  
  34.  
  35. number=   "555-555-5555-6879"
  36. name=     "Zaphod"
  37. pwd=      "HeartOfGold"
  38. repfile=  "c:\files\qwk\megadodo.rep"
  39.  
  40. CALL ZocTimeout 60
  41.  
  42. /******************************************/
  43. /* dial number and wait until we get in   */
  44. /* retry until three times or success     */
  45. /******************************************/
  46. done= "no"
  47. DO 3 UNTIL DONE="yes"
  48.     CALL ZocDial number
  49.     timeout= ZocWait("CONNECT")
  50.  
  51.     /* if no timeout (ie. if connected) */
  52.     IF timeout=0 THEN DO 
  53.  
  54.         /* log in (send name/password) */
  55.         CALL ZocWait "Press <ESC> twice to login"
  56.         CALL ZocSend "^[^["
  57.         CALL ZocWait "Name?"
  58.         CALL ZocSend user||"^M"
  59.         CALL ZocWait "Password?"
  60.         CALL ZocSend pwd||"^M"
  61.  
  62.         /* skip news bla bla and wait for main menu */
  63.         CALL ZocRespond "--Enter--", "^M"
  64.         CALL ZocRespond "--More--", "N"
  65.  
  66.         CALL ZocWait "MAIN MENU>"
  67.  
  68.         CALL ZocRespond "--Enter--"
  69.         CALL ZocRespond "--More--"
  70.  
  71.         DONE= "yes"
  72.     END
  73.  
  74. END /* DO 3 */
  75.  
  76. /******************************************/
  77. /* now see if there's a QWK packet for    */
  78. /* us to download                         */
  79. /******************************************/
  80. CALL ZocSend "Q^M"  /* choice 'Q' in the main menu */
  81. CALL ZocTimeout 5
  82. timeout= ZocWait("Packing ...")
  83. IF timeout\=640 THEN DO 
  84.     /* OK, packing could take some time */
  85.     CALL ZocTimeout 360
  86.     timeout= ZocWait("Start your download NOW!")
  87.     IF timeout\=640 THEN DO 
  88.         /* download to the C:\QWK\MEGADODO directory */
  89.         CALL ZocDownload("ZMODEM", "C:\QWK\MEGADODO")
  90.     END
  91. END
  92.  
  93. /******************************************/
  94. /* now that we're logged in, we check if  */
  95. /* there is a file to upload (and do it)  */
  96. /******************************************/
  97. IF stream(repfile,"C","QUERY EXISTS")\="" THEN DO
  98.     CALL ZocSend "R^M"  /* choice 'R' in the main menu */
  99.     CALL ZocWait "Start your upload NOW!"
  100.  
  101.     /* upload it */
  102.     status= ZocUpload("ZMODEM", repfile)
  103.  
  104.     /* Invoke and wait for the main menu prompt */
  105.     CALL ZocSend "^M"
  106.     CALL ZocWait "MAIN MENU>"
  107.  
  108.     /* if OK, delete it */
  109.     IF status="##OK##" THEN DO 
  110.         CALL ZocShell "DEL "||repfile
  111.     END
  112. END
  113.  
  114. /******************************************/
  115. /* OK, everything done.                   */
  116. /* Sign off                               */
  117. /******************************************/
  118. CALL ZocSend "G^M"  /* choice 'G' in the main menu */
  119. CALL ZocTimeout 30
  120. CALL ZocWait "Come back next time"
  121. CALL ZocHangup
  122.  
  123. finish:
  124. EXIT
  125.  
  126.