home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / main / BBS / DOVE-NET.ZIP / ZOCQWK11.ZIP / VERTPOLL.ZRX < prev   
Encoding:
Text File  |  1999-12-18  |  6.1 KB  |  212 lines

  1. /* REXX
  2. ******
  3. **  DO NOT Remove this HEADER or script will not work *******
  4. **
  5. **  Look at the REXX Help files included with ZOC for more information on
  6. **  the REXX Scripting Language and Functions.
  7. **
  8. **  This script is designed to allow Synchronet BBS Software to
  9. **  Automatically make a QWK Call with Telnet using the Terminal Program
  10. **  ZOC v3.13.  It should work when calling any version of Synchronet,
  11. **  however I have not tested this with older versions of ZOC.
  12. **
  13. **  ** NOTE: Some changes *may* be necessary to work with your system.
  14. **           Especially if the BBS has modified the [Pause] prompt or
  15. **           the QWK: Menu Prompt.  Look over it, this version works with
  16. **           Unmodified Synchronet v2.x and v3.  It's pretty intuitive as to
  17. **           what the script is doing.
  18. **
  19. **  ** This is the first version of this script.  It may not be perfect,
  20. **     so you can find a newer version at the below, or just edit the dam
  21. **     thing yourself!  :=)
  22. **
  23. **  This script will probably work with other BBS Software with only a few
  24. **  modifications.
  25. **
  26. **  This script is designed to work with a Terminal Program called ZOC which
  27. **  is available for Win95/98/NT and OS/2.
  28. **
  29. **  You can obtain ZOC at any of the below addresses.
  30. **
  31. **  To contact me or find a new version :
  32. **
  33. **  telnet://wasteland.darktech.org
  34. **  telnet://wasteland.detour.net
  35. **
  36. **    http://wasteland.darktech.org
  37. **
  38. **    http://www.emtec.com/
  39. **
  40. **   Email:  pg@wasteland.darktech.org                
  41. */
  42.  
  43. /* TRACE A */  /* Turn on (Uncomment) to Debug Script */
  44.  
  45. number=   "vert.sync3.net"           /* Change to your HUBS address */
  46. name=     "QWKID"                    /* Change to your BBS QWK ID */
  47. pwd=      "QWKPW"                    /* Your QWK ID Accounts PW on HUB */
  48. repfile=  "c:\sbbs\data\vert.rep"    /* Path and Name of your REP File */
  49. dldir=    "c:\sbbs\data"             /* Path to your SBBS\DATA Dir */
  50.  
  51. CALL ZocTimeout 60
  52.  
  53. /******************************************/
  54. /* dial number and wait until we get in   */
  55. /* retry until three times or success     */
  56. /******************************************/
  57. done= "no"
  58. DO 3 UNTIL DONE="yes"
  59.  
  60.     CALL ZocCls
  61.     CALL ZocSetDevice "TELNET"
  62.     CALL ZocDial number
  63.  
  64.     timeout= ZocWait("[TELNET] CONNECT")
  65.  
  66.     /* if no timeout (ie. if connected) */
  67.     IF timeout=0 THEN DO 
  68.  
  69.         /* log in (send name/password) */
  70.  
  71. /* Might need these lines if calling a HUB Using FrontDoor */
  72.  
  73. /*      CALL ZocWait "Press <ESC> twice to login"
  74.         CALL ZocSend "^[^[" 
  75. */
  76.         
  77.         /* Might need to change these lines below if */
  78.         /* your Hub has modified their Login Prompts */
  79.  
  80.         CALL ZocWait "NN: "
  81.         CALL ZocSend name||"^M"
  82.         CALL ZocWait "PW: "
  83.         CALL ZocSend pwd||"^M"
  84.  
  85.  
  86.         /* Might need to change pause prompts below */
  87.         /* if your Hub has modified his Pause Prompt */
  88.  
  89.         /* Wait for the QWK Prompt */
  90.         CALL ZocRespond "[Pause]", "^M"   
  91.  
  92.         CALL ZocWait "QWK: "
  93.  
  94.         CALL ZocRespond "[Pause]"
  95.  
  96.         DONE= "yes"
  97.     END
  98.  
  99. END /* DO 3 */
  100.  
  101. /******************************************/
  102. /* now that we're logged in, we check if  */
  103. /* there is a file to upload (and do it)  */
  104. /******************************************/
  105. QwkUpload:
  106. IF stream(repfile,"C","QUERY EXISTS")\="" THEN DO
  107.  
  108.     CALL ZocSend "U"  /* choice 'U' in the QWK menu */
  109.     CALL ZocWait "Protocol"
  110.     CALL ZocSend "Z"  /* Select Zmodem Protocol */
  111.     CALL ZocWait "Hang"
  112.     CALL ZocSend "N"  /* Say NO to Hang-UP Question */
  113.     /* upload it */
  114.  
  115.     status= ZocUpload("ZMODEM", repfile)
  116.  
  117.     /* if OK, delete it */
  118.      IF status="##OK##" THEN DO 
  119.         CALL ZocShell "DEL "||repfile
  120.         CALL ZocWriteLn "REXX : QWK Upload is Complete!"
  121.         CALL ZocTimeout 20
  122.         timeout= ZocWait("QWK:")
  123.          IF timeout=0 THEN DO
  124.            SIGNAL DownloadStart
  125.      END
  126.      END
  127. END
  128. ELSE DO        
  129.      CALL ZocWriteLn "REXX : No QWK REP File to be Uploaded!"
  130.      SIGNAL DownloadStart
  131. END
  132.  
  133. /******************************************/
  134. /* now see if there's a QWK packet for    */
  135. /* us to download                         */
  136. /******************************************/
  137. DownloadStart:
  138.  
  139. CALL ZocSend "D"  /* choice 'D' from the QWK menu */
  140.  
  141. CALL ZocTimeout 240
  142. result= ZocWaitMux("No new", "Filename", "Protocol")
  143. SELECT
  144.     WHEN result=0 THEN SIGNAL NoDownload
  145.     WHEN result=1 THEN SIGNAL QwkDownload
  146.     WHEN result=2 THEN SIGNAL QwkDownload
  147.     WHEN result=640 THEN SIGNAL MoreTime
  148. END
  149.  
  150.  
  151. NoDownload:
  152.    CALL ZocWriteLn "REXX : No New Messages!  -  Exiting Script"
  153.    CALL ZocTimeout 5
  154.    SIGNAL Finish
  155.  
  156.  
  157. QwkDownload:
  158.   CALL ZocSend "Z"     /* Zmodem Protocol Selection */
  159.   CALL ZocSend "N"     /* Say No To hang up after question */
  160.   
  161.       result= ZocDownload("ZMODEM", dldir)
  162.        IF result="##ERROR##" THEN DO
  163.          CALL ZocBeep 2
  164.          CALL ZocWriteLn "REXX : Error Downloading QWK File!"
  165.          SIGNAL Finish
  166.        END
  167.        ELSE DO
  168.          CALL ZocTimeout 20
  169.          timeout= ZocWait("QWK: ")
  170.           IF timeout=0 THEN DO
  171.             CALL ZocWriteLn "REXX : QWK Download Completed"
  172.             SIGNAL Finish
  173.           END  
  174.        END    
  175.  
  176. MoreTime:
  177.  
  178. CALL ZocWriteLn "REXX : I am Waiting Longer for QWK Packing to Complete!"
  179. CALL ZocTimeout 30
  180. timeout= ZocWait("Protocol")
  181.   IF timeout=640 THEN DO
  182.     SIGNAL ErrorPacking
  183.   END
  184.  
  185. ErrorPacking:
  186.   CALL ZocBeep 2
  187.   CALL ZocWriteLn "REXX :  ERROR  -  QWK Packing Timed Out!"
  188.   SIGNAL Finish
  189.  
  190. /******************************************/
  191. /* OK, everything done.                   */
  192. /* Sign off                               */
  193. /******************************************/
  194. Finish:
  195. CALL ZocWriteLn "REXX : QWK Polling is Complete Exiting Script!"
  196.  
  197. CALL ZocSend "Q"  /* choice 'Q' in the QWK menu */
  198.  
  199. CALL ZocTimeout 20
  200. timeout= ZocWait("[TELNET]")
  201. IF timeout=0 THEN DO
  202.   CALL ZocHangup
  203.   CALL ZocEndZoc
  204.   EXIT
  205. END
  206. ELSE DO
  207.   CALL ZocWriteLn "REXX : QWK Polling is Complete Exiting Script! (No DISCONNECT Info Received)"
  208.   CALL ZocHangup
  209.   CALL ZocEndZoc
  210. EXIT
  211. END
  212.