home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / TE2SC121.ZIP / MaxQWK.Scr < prev    next >
Text File  |  1992-07-21  |  4KB  |  150 lines

  1. ;; -------------------------------------------------------------------------
  2. ;;
  3. ;; MaxQWK.Scr -- Copyright (c) 1992, Oberon Software, Mankato Mn
  4. ;;               Author: Brady Flowers, 07/19/92
  5. ;;
  6. ;; Usage: This is setup specifically for automatic upload and download
  7. ;;        of QWK Packets to and from Pete Norloff's OS/2 Shareware BBS.
  8. ;;        There are several ways this script could be run:
  9. ;;
  10. ;;          1. Attached to a dialing directory entry.  In this case you
  11. ;;             must have MaxLogin.Scr and Bink2BBS.Scr present somewhere
  12. ;;             on your ScriptPath.
  13. ;;
  14. ;;          2. From the Alt-/ Command Prompt:
  15. ;;             a. If you are off line, you must have MaxLogin.Scr and
  16. ;;                Bink2BBS.Scr available to be run.
  17. ;;             b. If you are already logged to the BBS, you MUST be sitting
  18. ;;                at the BBS's "Main Menu" prompt.  This is the only usage
  19. ;;                that does NOT require MaxLogin.Scr and Bink2BBS.Scr.
  20. ;;
  21. ;;          3. From another script.  You may want to schedule execution
  22. ;;             of this script to do unattended QWK mailings via some timed
  23. ;;             execution utility.  To do this, you should make sure that
  24. ;;             the MaxLogin.Scr and Bink2BBS.Scr files are available to
  25. ;;             be executed, you should edit this file to remove the call
  26. ;;             to GetYesNo() near the bottom of this file and make it such
  27. ;;             that an unconditional logoff will be performed, and you
  28. ;;             should create a script file that contains:
  29. ;;
  30. ;;                  program
  31. ;;                    run("MaxQWK")
  32. ;;                    exit(FALSE)
  33. ;;                    end
  34. ;;
  35. ;;             Assuming that you name that script AutoQWK.Scr, your
  36. ;;             TE/2 command line should look like: "te2 -mAutoQWK".
  37. ;;
  38. ;; -------------------------------------------------------------------------
  39.  
  40. string  QWKInbound  = "D:\PMQWK\InBound"    ;; <<== Set this as appropriate
  41. string  QWKOutbound = "D:\PMQWK\OutBound"   ;; <<== Set this as appropriate
  42. string  REPPacket   = "OS2SHARE.REP"
  43.  
  44. string  SaveDLPath
  45. integer SaveClobber
  46. integer SaveQZM
  47. integer SaveXonXoff
  48. integer fREPPacket
  49. integer fQWKPacket
  50.  
  51. ;; --------------------------------------------------------------------------
  52.  
  53. subroutine SetupQWK
  54.  
  55.   SaveDLPath     = DownLoadPath
  56.   SaveClobber    = ClobberDL
  57.   SaveQZM        = QueryZMRecover
  58.   SaveXonXoff    = XonXoff
  59.  
  60.   setxonxoff(0)
  61.   DownLoadPath   = QWKInbound
  62.  
  63.   ;; Possible settings for ClobberDL:
  64.   ;;   -1 -> rename an existing file and continue xfer
  65.   ;;    1 -> overwrite any existing file
  66.   ;;    0 -> abort xfer if file exists
  67.   ClobberDL      = -1
  68.  
  69.   ;; Set ZModem recovery OFF, it would be a real pain to have the recovery
  70.   ;; menu pop up during an unattended transfer!
  71.   QueryZMRecover = FALSE
  72.  
  73.   ;; Discover if a .REP packet exists
  74.   REPPacket = QWKOutbound + "\" + REPPacket
  75.   fREPPacket = fopen(REPPacket, "r")
  76.   if (fREPPacket & 0x0000ffff)
  77.     fclose(fREPpacket)
  78.     fREPPacket = TRUE
  79.   else
  80.     fREPPacket = FALSE
  81.   endif
  82.  
  83. endsub
  84.  
  85.  
  86. ;; --------------------------------------------------------------------------
  87.  
  88. subroutine UnSetupQWK
  89.  
  90.   DownLoadPath   = SaveDLPath
  91.   ClobberDL      = SaveClobber
  92.   QueryZMRecover = SaveQZM
  93.   setxonxoff(SaveXonXoff)
  94.  
  95. endsub
  96.  
  97.  
  98. ;; --------------------------------------------------------------------------
  99.  
  100. subroutine QWKXfer
  101.  
  102.   if fREPPacket
  103.     transmit("ou^M")
  104.     waitfor("^Q", 300)
  105.     if upload(ZMODEM, REPPacket)
  106.       erase(REPPacket)
  107.     else
  108.       FileError("Error uploading file, aborting script! ", REPPacket)
  109.       stop
  110.     endif
  111.     waitfor("Select:", 300)
  112.     transmit("d^M")
  113.   else
  114.     transmit("od^M")
  115.   endif
  116.  
  117.   fQWKPacket = muxwait("/[Y,n]?/Select:/", 300)
  118.   if fQWKPacket == 1
  119.     transmit("Y^M")
  120.     waitfor("<esc> to abort:", 300)
  121.     transmit("^M")
  122.     waitfor("cancel.", 300)
  123.     download(ZMODEM, "")
  124.     waitfor("Select:", 300)
  125.   endif
  126.  
  127. endsub
  128.  
  129.  
  130. ;; --------------------------------------------------------------------------
  131.  
  132. program
  133.  
  134.   if !connected
  135.     run("MaxLogin")
  136.   endif
  137.  
  138.   if connected
  139.     gosub SetupQWK
  140.     gosub QWKXfer
  141.     gosub UnSetupQWK
  142.     if GetYesNo("QWK Mail processing completed.", "Do you want to log off now?", TRUE)
  143.       transmit("g;y;n^M")
  144.       waitfor("Please call again!", 30)
  145.       hangup(FALSE)
  146.     endif
  147.   endif
  148.   end
  149.  
  150.