home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / hslmail2.zip / HSLMAIL2.SCR < prev    next >
Text File  |  1993-09-07  |  16KB  |  463 lines

  1.  
  2. ;                             HSLMAIL2.SCR
  3.  
  4. ; This script may be used *only* with QmodemPro for
  5. ; unattended mail transfers from Tomcat on Wildcat! BBSs which
  6. ; support Sam Smith's HSLINK file transfer protocol. Echo mail
  7. ; discussions are available via the RIME network in Conference #
  8. ; 37 on the DRS BBS.
  9.  
  10. ; This is the bulldog version of DRSMAIL7.SCR - I called it a
  11. ; "bulldog" because once engaged this script will repeatedly call
  12. ; the BBS even though it is aborted by timeouts, bad connections,
  13. ; or crashed BBSs
  14.  
  15. ; Copy it to your SCRIPTS subdirectory but do not link it in your
  16. ; QM phone directory to a BBS entry.  This script must be called
  17. ; as QmodemPro is loaded with the DOS command string
  18. ; QMPRO /S=HSLMAIL1.SCR using the batch file named QMPHSL.BAT
  19. ; which is included here.
  20.  
  21. ; HSLINK must be installed as an External File Transfer Protocol
  22. ; in QmodemPro.  Instructions for installing an External
  23. ; FTP are contained in the documentation files accompanying
  24. ; QmodemPro and will not be repeated here.
  25.  
  26. ; The basic batch files used are named HSLDWN.BAT and HSLUP.BAT
  27. ; and are included in this ZIP. Two additional batch files named
  28. ; HSLDWNF.BAT and HSLUPF.BAT are also included which may be used
  29. ; under optimal line conditions with MNP modems to increase the
  30. ; speed of transfers. Note that you must use a text editor to
  31. ; insert the *download* path for your own system in these files;
  32. ; just *replace* F:\QMP\DOWNLOAD with your own path (do not remove
  33. ; the -U switch as that identifies this path to HSLINK)
  34.  
  35. ; Since HSLINK will not auto-increment filenames on its own this
  36. ; script will rename $BBSID.QWK while loading to avoid any later
  37. ; filename conflict.
  38. ;
  39. ; For DRS BBS, your download directory is checked for a file named
  40. ; CTDRS.QWK and if found, the script will rename it using a numeral
  41. ; read from the file RENDAT.NUM (which the script itself will
  42. ; create the first time it is executed). HSLINK will then be able
  43. ; to download a new file named CTDRS.QWK without overwriting
  44. ; anything.  If no file named CTDRS.QWK is found in your download
  45. ; directory the script will continue without renaming anything.
  46.  
  47. ; HSLMAIL2.SCR then will prompt you for a starting time after
  48. ; that's entered then wait until that start time arrives
  49. ; before continuing.  This permits you to easily change the
  50. ; time at which an unattended mail transfer is started from day to
  51. ; day.
  52.  
  53. ; You are required to insert values for the variables USER,
  54. ; PASS, BBSID, BBSNUM, LIMIT, and PREFIX to suit your system
  55. ; and to be sure that QmodemPro is correctly configured
  56. ; as described below.  The value presently assigned to
  57. ; BBSNUM is that of the DRS BBS but if you want to
  58. ; use this same script for calling some other Wildcat BBS just
  59. ; make the appropriate variable changes (and change the name of
  60. ; the script to avoid confusing the *.BAT programs).
  61.  
  62. ;===== This script is written to take advantage of the ability of
  63. ;===== HSLINK to Auto-start. The Auto Download string must be entered
  64. ;===== in the field provided in Alt-N/C/P/E of QmodemPro. This
  65. ;===== string is HS*^BR.
  66.  
  67. ;===== Also, *both* Download Batch and Upload Batch fields must
  68. ;===== be toggled to Y since a QMPRO.BEW file is used to direct
  69. ;===== the transfer of files.  The UPLOAD command in the script
  70. ;===== will then cause QmodemPro to write the $REPPATH$BBSID.REP
  71. ;===== to QMPRO.BEW and that specifies the file to be uploaded
  72. ;===== which HSLINK will substitute for the %4 replaceable
  73. ;===== paramter in HSLUP.BAT.  These same batch files may be used
  74. ;===== for file transfers other than QWK/REP packets in the usual
  75. ;===== way.
  76.  
  77. ;===== Check to be sure that you have QmodemPro configured so it
  78. ;===== will not save partial files.
  79.  
  80. ;===== The BBS you call must support HSLINK or you cannot use it
  81. ;===== there. For maximum flexibility you may wish to go to Your
  82. ;===== Settings in the Main Menu of your Wildcat BBS and set
  83. ;===== Transfer Protocol to SELECT. This script will then select
  84. ;===== HSLINK just before the transfer.  Alternatively, you must
  85. ;===== set Transfer Protocol to HSLINK or this script will derail
  86. ;===== as the BBS attempts a transfer with some other protocol you
  87. ;===== may have chosen as the default.
  88.  
  89. ;===== When you are satisfied that HSLMAIL1.SCR is running
  90. ;===== correctly on your system, you may wish to remove all the
  91. ;===== Comments I've included here.
  92.  
  93. ;===================== User Variables ===============================
  94.  
  95. String BEW BBSID BBSNUM LIMIT PASS PADONE PADTWO PREFX QMDIR RENDAT USER
  96.  
  97. Assign USER "Karl Hakmiller"      ;Insert your name - may not use
  98.                                   ;$USERID variable in an unlinked
  99.                                   ;script; space in name requires
  100.                                   ;enclosing quotation marks.
  101.  
  102. Assign PASS "xxxxx"               ;Insert your password on the BBS
  103.                                   ;and be certain you remove it
  104.                                   ;before sharing the script.
  105.  
  106. Assign BBSID CTDRS                ;Insert the packet name for the
  107.                                   ;BBS you are calling
  108.  
  109. Assign BBSNUM 297-5907            ;Insert the phone number of the
  110.                                   ;BBS being called; if spaces are
  111.                                   ;used in the number enclose the
  112.                                   ;whole number in double-quotes.
  113.  
  114. Assign LIMIT 600                  ;The BBS SysOp will have
  115.                                   ;assigned a limit on the number
  116.                                   ;of messages Tomcat will add to
  117.                                   ;your packet following each DL
  118.                                   ;command. I have written this
  119.                                   ;script so that it will make
  120.                                   ;REPEATED download passes if you
  121.                                   ;reach the Message Limit that
  122.                                   ;has been set for you - with the
  123.                                   ;result you will receive all of
  124.                                   ;your new mail providing only
  125.                                   ;that your access level allots
  126.                                   ;you enough on-line time. You'll
  127.                                   ;see the limit allotted you on
  128.                                   ;the screen when Tomcat runs the
  129.                                   ;first time and you can change
  130.                                   ;this variable accordingly.
  131.  
  132. Assign PREFX ATDT                 ;Replace ATDT with ATDP is you
  133.                                   ;are calling on a PULSE (Rotary
  134.                                   ;Dial) line.  ATDT is for a TONE
  135.                                   ;line.
  136.  
  137. Assign QMDIR F:\QMP\              ;Your QmodemPro home directory
  138.  
  139.  
  140. ;========================= No further changes required ===============
  141.  
  142.  
  143. ; This next section manages the renaming of a QWK packet which
  144. ; might cause a filename conflict on download.
  145.  
  146. Assign RENDAT RENDAT.NUM          ;Name of file - RENDAT.DAT - in
  147.                                   ;your QMDIR containing the
  148.                                   ;numeral which will be used to
  149.                                   ;rename your QWK packets to
  150.                                   ;prevent overwriting.
  151.  
  152. Assign PADTWO 00                  ;Left pad for RENDAT numerals
  153.                                   ;less than 10
  154.  
  155. Assign PADONE 0                   ;Left pad numerals 10-99
  156.  
  157. Assign BEW "$BBSID.REP"
  158.  
  159. Assign 0 00:00:00            ;Reset starting time to 00:00:00
  160. Assign 1 0                   ;Counter for RING attempts
  161. Assign 2 0                   ;Counter for BULLDOG calls
  162. Assign 3 0                   ;Counter for BUSTOUT calls
  163. Assign 4 0                   ;Variable containing numeral 001-998
  164. Assign 5 0                   ;Variable containing CONNECT speed
  165.  
  166.  
  167. EXIST $QMDIR$RENDAT OPEN1       ;Goes to OPEN1 if RENDAT.NUM already exists
  168. Openfile $QMDIR$RENDAT Rewrite  ;Creates the file RENDAT.NUM if not there
  169. Assign 4 1
  170. Writefile 4 1                   ;Writes the numeral 1 to the RENDAT.NUM file
  171. Closefile
  172.  
  173. OPEN1:
  174. Openfile $QMDIR$RENDAT Read
  175. Readfile 4                  ;Reads RENDAT.NUM content as integer value.
  176.   Incr 4                    ;Adds 1 to numeral found in RENDAT.NUM
  177.   If "$4" >= "998" RESETIT  ;Tests for limit of RENDAT numeral.
  178.   If "$4" <= "9"   PAD2     ;Left pads 1-9 with 00
  179.   If "$4" <= "99"  PAD1     ;Left pads 10-99 with 0
  180.  Closefile
  181. Goto OPEN2
  182.  
  183. RESETIT:
  184.  Closefile
  185.   Openfile $QMDIR$RENDAT Rewrite
  186.     Assign   4 1                    ;Resets $4 (998) to 1.
  187.     Writefile 4                     ;Writes $4 to RENDAT.NUM.
  188.   Closefile
  189.  Goto OPEN1
  190.  
  191. PAD2:                              ;Pads RENDAT numerals < 10 with left 00.
  192.  Closefile
  193.  Openfile $QMDIR$RENDAT Rewrite
  194.    Assign 4 "$PADTWO$4"             ;Resets $4 (n < 10) to 00n).
  195.  Writefile $4                       ;Writes 00n to RENDAT.NUM.
  196.  Closefile
  197.  Goto CHECKDUP
  198.  
  199. PAD1:                               ;Pads RENDAT numerals 10-99 with left 0
  200.  Closefile
  201.  Openfile $QMDIR$RENDAT Rewrite
  202.    Assign 4 "$PADONE$4"             ;Resets $4 (n 10-99 ) to 0n).
  203.  Writefile $4                       ;Writes 0n to RENDAT.NUM.
  204.  Closefile
  205.  Goto CHECKDUP
  206.  
  207. OPEN2:
  208.  Closefile
  209.  Openfile $QMDIR$RENDAT Rewrite
  210.  Writefile $4
  211.  Closefile
  212.  
  213. CHECKDUP:
  214. EXIST $QWKPATH$BBSID.QWK RENAMEIT
  215. Goto RUNTIME
  216.  
  217. RENAMEIT:
  218. DisplayLn "Found CTDRS.QWK - renaming to avoid conflicting filenames"
  219. Pause 2000
  220. DOS "RENAME $QWKPATH$BBSID.QWK $BBSID$4.QWK"      ;Renames old packet
  221.                                                    ;with next numeral in
  222.                                                    ;RENDAT.NUM
  223.  
  224. ;This next section prompts the user for a starting time
  225.  
  226.  
  227. RUNTIME:
  228. DisplayLn "Current system time is $TIME"
  229. DisplayLn "----------------------------"
  230. Display "Enter hh:mm:ss starting time: "
  231. Getn 0 8                                     ;GETN will accept 8 chars
  232.                                              ;from the keyboard
  233.                                              ;and assign them to
  234.                                              ;the variable $0
  235. DisplayLn "You entered $0"
  236.  
  237. DisplayLn "Script will begin to run at $0"
  238.  
  239.  
  240. WAITUNTIL $0
  241.  
  242. ;The QWK/REP transfer script follows
  243.  
  244. TIPTOP:
  245. TurnON   ONLINE
  246. TurnON   8_BIT
  247. TurnOFF  LINEFEED
  248. TurnOFF  XON/XOFF
  249. TurnON   NOISE
  250. TurnOFF  MUSIC
  251. TurnON   SCROLL
  252. TurnOff  PRINT
  253. TurnOff  SPLIT
  254. TurnOn   STATUSLN
  255. TurnOFF  DOORWAY
  256.  
  257. Capture $DATE.HSL
  258. LOG MAIL.LOG                 ;Start a log running.
  259. Stamp LOG started on $DATE at $TIME
  260.  
  261.  
  262. LOOP1:
  263. Timeout 70 WARN              :Set Timeout at 70 seconds
  264. Pause 500                    ;Pause between dial attempts
  265. When
  266. Incr 1
  267. DisplayLn "  ...Trying RING #$1 "
  268. When "BUSY" LOOP1
  269. When "VOICE" LOOP1
  270. When "NO CARRIER" LOOP1
  271. When "2400/ARQ" BULLDOG
  272. When "9600/V32" BULLDOG
  273. When "?~?~?~?~?"  BULLDOG
  274. Send "$PREFX$BBSNUM^M"
  275. Pause 500
  276. Waitfor "Connected at "
  277. Getx 5 4 b
  278.  
  279. DisplayLn "  Normal CONNECT has been made at $5 baud."
  280. Delay 500
  281. Stamp Normal CONNECT in $1 attempts on $DATE at $TIME
  282. Stamp Connected at $5 baud
  283. Clrscr
  284. Color 31
  285.  
  286. TOP:
  287. Timeout 70 BULLDOG
  288. When
  289. When "9600/V32" BULLDOG                  ;Reject a non-HST link
  290. When   "incorrectly" REPEAT              ;Sent name incorrectly, try again
  291. When   "Wrong" "$PASS^M"                 ;Sent password incorrectly
  292. When "NO CARRIER" BULLDOG
  293. Waitfor "first name"                     ;This is the Fast Login route to
  294. Delay 100                                ;the Tomcat Mail Door (!). It skips
  295. Send "!$USER $PASS^M"                    ;opening Bulletins/Newsletters/Menus
  296.  
  297.  
  298. TOMMY:
  299. Flush COM
  300. Timeout 70 BULLDOG
  301. When
  302. When "Qmodem Host Command" BBSDOWN       ;QM HOST may be up when BBS is down
  303. When "top?" "C^M"
  304. Waitfor  "TOMCAT MENU [D U"
  305. Delay  200
  306. Send     "D^M"                            ;Begin Download Mode
  307. Delay 100
  308.  
  309. Timeout 600 BULLDOG
  310. When
  311. When "NO CARRIER" BULLDOG
  312. When  "Total messages found: $LIMIT"  PUSHMORE       ;More mail possible
  313. When "Nothing found to download" CHEKREP
  314. CONT1:
  315. When  "done?" "Y^M"                                  ;Accept download
  316. When "PROTOCOL MENU" "H^M"                           ;Select HS/LINK
  317. Waitfor "Start"                                      ;Begin transfer
  318. Delay 100
  319. Upload H  $REPPATH$BBSID.REP                        ;Note that the HSLINK
  320.                                                      ;*upload* batch file will
  321.                                                      ;be called but the
  322.                                                      ;download will also be
  323.                                                      ;done by HSLINK
  324.  
  325. MOREMAIL:
  326. Pop 4                                                ;Take $4 from stack
  327. If "$4" = "MORE" TOMMY                               ;Go for more mail
  328.  
  329. If $SUCCESS SCRUBREP                                 ;Delete uploaded REP file
  330. Goto GETOUT
  331.  
  332. CHEKREP:
  333. Exist $REPPATH$BBSID.REP DOUP
  334. Goto GETOUT
  335.  
  336. DOUP:
  337. Timeout 60 ABORT
  338. Waitfor  "TOMCAT MENU [D U"
  339. Send "U^M"
  340.  
  341. Timeout 60 ABORT
  342. When "PROTOCOL MENU" "H^M"                           ;Select HS/LINK
  343. Waitfor "Start"
  344. Delay 100
  345. Upload H $REPPATH$BBSID.REP
  346.  
  347. If $SUCCESS SCRUBREP                                 ;Delete uploaded REP file
  348. Goto GETOUT
  349.  
  350. REPEAT:
  351. Send "N^M"
  352. Delay 100
  353. Send "^M"
  354. Stamp Incorrect Name/Password on $DATE at $TIME
  355. Goto TOP
  356.  
  357. WARN:
  358. Color 15
  359. Clrscr
  360. Note Timed out while waiting for CONNECT.
  361. Note This indicates that a non-standard return code was received.
  362. Note Standard return codes: CONNECT, BUSY, VOICE, NO CARRIER, and NO DIALTONE
  363. DisplayLn "Pausing 8 seconds before continuing to BULLDOG..."
  364. Pause 8000
  365.  
  366. BULLDOG:
  367. Stamp BULLDOG engaged after $1 RINGS on $DATE at $TIME
  368. Clrscr
  369. Incr 2
  370. DisplayLn "Bulldog engaged - pausing 10 seconds before the next bite!"
  371. Box 1 3 44 15
  372. Color 46
  373. DisplayLn "                                        "
  374. DisplayLn "              .........                 "
  375. DisplayLn "         /^) ...........(^ \            "
  376. DisplayLn "       /    <_<_...._>_>     \          "
  377. DisplayLn "     /  /..  -.-   -.-    ..\  \        "
  378. DisplayLn "    | |   ...  (   )  ...     | |       "
  379. DisplayLn "     ~   ...    ____    ...    ~        "
  380. DisplayLn "        .... Vv-------vV....            "
  381. DisplayLn "          ................              "
  382. DisplayLn "                                        "
  383. DisplayLn "                                        "
  384. Pause 10000
  385. Color 14
  386. Stamp Bulldog has now been called $2 times on $DATE    ;Log message
  387. If $ONLINE BUSTOUT
  388. TurnOff LOG
  389. Hangup
  390. Gosub BIGSCRN
  391. Clrscr
  392. Goto TIPTOP
  393.  
  394. BUSTOUT:
  395. Clrscr
  396. Incr 3
  397. Timeout 30 BULLDOG
  398. When
  399. When   "Command >> ?" "G^M"
  400. When   "TOMCAT MENU [D U" "G^M"
  401. When   "logoff [Y]?" "Y^M"
  402. Hangup
  403. Waitfor "NO CARRIER"
  404. Stamp  Bustout has now been called $3 times on $DATE    ;Log message
  405. TurnOff LOG
  406. Goto BULLDOG
  407.  
  408. PUSHMORE:
  409. Assign 4 MORE                   ;Assign MORE to $4
  410. Push $4                         ;Push MORE on stack
  411. Goto CONT1                      ;Go get pending mail packet
  412.  
  413. SCRUBREP:
  414. Deletef $REPPATH$BBSID.REP
  415. Delay 100
  416. Goto GETOUT
  417.  
  418. BBSDOWN:
  419. Stamp Connected Qmodem HOST on $DATE at $TIME
  420. Stamp Exited HOST at $TIME
  421. TurnOff LOG
  422. Send "G^M"
  423. Hangup
  424. Goto TIPTOP
  425.  
  426. GETOUT:
  427. Timeout 30 CHECKOUT
  428. Clrscr
  429. Gosub BIGSCRN
  430. Waitfor   "TOMCAT MENU [D U C H G Q]:"
  431. Delay   100
  432. Send      "G^M"                             ;Be polite - issue Goodbye
  433.  
  434. CHECKOUT:
  435. Timeout 30 BAILOUT
  436. When
  437. When  "[Y/n]?" "^M"                          ;Confirm logoff request
  438. Delay 100
  439. Waitfor "NO CARRIER"
  440. Delay 100
  441. Hangup                                       ;Be sure you are offline
  442. DisplayLn "  Normal exit from script"
  443. Delay 500
  444. Stamp NORMAL exit on $DATE at $TIME
  445. Stamp ================= END ==========================
  446.  
  447.  
  448. TurnOff LOG
  449. System Y                                     ;Leave script & QM for DOS
  450.  
  451. BAILOUT:
  452. Stamp Bailed out on $DATE at $TIME
  453. Stamp ============== BAILED OUT =====================
  454. TurnOff LOG
  455. Hangup
  456. System Y
  457.  
  458. BIGSCRN:                        ;This is a SUBROUTINE
  459. Window 1 1 80 24                ;Make screen 80x24
  460. Color 31                        ;Make screen bright white on blue
  461. Return                          ;Return to next script line
  462.  
  463.