home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR10 / HSLMAIL4.ZIP / HSLMAIL4.SCR < prev    next >
Text File  |  1993-09-07  |  19KB  |  506 lines

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