home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / HCSNET2C.ZIP / HCSNET.SCR < prev    next >
Encoding:
Text File  |  1992-10-20  |  14.9 KB  |  443 lines

  1. STRING NAME DOOR NODEID PATH INIT       ; set up special variables
  2. STRING TYPE PHONE PWRD HUB DIALS WAIT
  3. STRING PROT CALLERS GARBAGE G2 ESC
  4. STRING LOGFILE TEXT BAUDRATE INBAUD
  5. STRING P1 P2 P3 P4 P5 P6 P7 P8 P9 CIRCNUM
  6.  
  7. ASSIGN PROT "Z"                         ; set the protocol.  If the protocol
  8.                                         ; is external, it MUST be defined in
  9.                                         ; Qmodem install routine <ALT>N
  10.  
  11. ASSIGN PWRD "YOUR-PASSWORD"             ; you must set this variable if
  12.                                         ; using TYPE MAN
  13.  
  14. ASSIGN NAME "FIRSTNAME LASTNAME"        ; your name goes here
  15.  
  16. ASSIGN DOOR "QWK"                       ; the door number for you hub here
  17.  
  18. ASSIGN NODEID "HCS_BBS"                 ; QWK/REP id goes here for HUB you
  19.                                         ; will be transfering mail with. 
  20.  
  21. ASSIGN HUB "HCS_BBS"                    ; ID code for your HUB
  22.  
  23. ASSIGN PATH "C:\QMODEM\UD"              ; path to QWK & REP packet
  24.                                         ; The GAPNET QWK/REP dir should be
  25.                                         ; both aimed at your comm prg Upload-
  26.                                         ; Download directory.
  27.                                         ; DO NOT use a trailing backslash
  28.  
  29. ASSIGN INIT "Z"                         ; modem init string null if none used
  30.                                         ; * NOTE:  If your modem defaults
  31.                                         ; to MNP ON, and your HUB does not
  32.                                         ; have an MNP modem, then you MUST
  33.                                         ; put the MNP OFF command here.
  34.                                         ; otherwise, the script will never
  35.                                         ; see the CONNECT message to
  36.                                         ; determine if we have a baud rate
  37.                                         ; match) and the script will keep
  38.                                         ; recycling.
  39.  
  40. ASSIGN TYPE "MAN"                       ; type is MAN or DIR
  41.                                         ; - if type MAN then put the
  42.                                         ; actual telephone number(s) of the
  43.                                         ; hub in P1 - P9,if type DIR then put
  44.                                         ; the number of the dialing directory
  45.                                         ; record in PHONE
  46.  
  47.  
  48. ASSIGN P1 "1-216-273-9001"              ;These are the phone numbers for
  49. ASSIGN P2 "1-216-273-8224"              ;dialing your HUB.  You may enter
  50. ASSIGN P3 "1-216-273-8981"              ;up to 4 phone numbers for
  51. ASSIGN P4 ""                            ;circular MANual dialing.
  52. ASSIGN P5 ""                            ;the script will automatically
  53. ASSIGN P6 ""                            ;detect the presence of multiple
  54. ASSIGN P7 ""                            ;phone numbers.  If you are not
  55. ASSIGN P8 ""                            ;using an entry, make sure it is
  56. ASSIGN P9 ""                            ;blank, as in ASSIGN P4 ""
  57.                                         ;add 1+AreaCode if needed
  58.  
  59. ASSIGN PHONE ""                         ; your hub's dialing directory number
  60.                                         ; if you are using type DIR.
  61.                                         ; IF YOU ARE USING 'DIR' TYPE
  62.                                         ; DIALING THEN YOUR PASSWORD MUST
  63.                                         ; BE IN THE DIALING DIRECTORY.
  64.                                         ; Those using MAN dialing can
  65.                                         ; leave this field blank ""
  66.  
  67. ASSIGN DIALS 100                        ; Maximum number of dial attempts if
  68.                                         ; using TYPE MAN.
  69.  
  70. ASSIGN GARBAGE 3                        ; Maximum number of
  71.                                         ; attempts to recover
  72.                                         ; from line noise
  73.                                         ; (garbage connection)
  74.                                         ; set this number fairly
  75.                                         ; low, as each 'garbage'
  76.                                         ; connect is really a
  77.                                         ; billable 10 sec. call
  78.  
  79.  
  80.  
  81. ASSIGN WAIT 5000                        ; Number of milliseconds to wait
  82.                                         ; between re-dial attempts when
  83.                                         ; using type MAN.  1000=1 second.
  84.                                         ; recommended value is 5000 for a
  85.                                         ; 5 second re-dial pause.  This
  86.                                         ; will prevent your HUB from getting
  87.                                         ; stuck with continuous modem reset
  88.                                         ; errors
  89.  
  90. ASSIGN LOGFILE ""                       ; This is where you assign the log
  91.                                         ; file you want to use.  If left
  92.                                         ; blank, no log file will be
  93.                                         ; opened.
  94.  
  95. ASSIGN BAUDRATE "38400"                 ; This is the standard baud rate
  96.                                         ; you want the script to use for
  97.                                         ; communicating with the hub.  This
  98.                                         ; is necessary to allow for shifting
  99.                                         ; baud rates in the incoming caller
  100.                                         ; routines.  It is handled this way
  101.                                         ; because a lot of modems cannot
  102.                                         ; lock the link rate.  If you are
  103.                                         ; using a modem that is set to lock
  104.                                         ; the link rate, set this value to 0
  105.  
  106.  
  107. ASSIGN 9 0                              ; these are loop counter variables
  108. ASSIGN G2 0                             ; DO NOT change these values
  109. ASSIGN CALLERS 0
  110. ASSIGN CIRCNUM 0
  111.  
  112. ;----------------------------------------------------------------------------
  113. ;
  114. ;         MAKE SURE YOU FILL IN ALL YOUR DATA ABOVE !!!!!
  115. ;
  116. ;----------------------------------------------------------------------------
  117. INITIALIZE:
  118.         IF '$LOGFILE' = '' NOLOG
  119.         LOG $LOGFILE
  120. NOLOG:
  121.         STAMP RelayNet(tm) mail script started at $TIME on $DATE ****
  122.         IF '$0' = '' INITIALIZE1
  123.         SETCOMM $0
  124.  
  125. INITIALIZE1:
  126.         IF '$BAUDRATE' = '0' SKIP_BINIT
  127.         DISPLAYLN 'Setting baud rate to $BAUDRATE'
  128.         SETCOMM $BAUDRATE
  129. SKIP_BINIT:
  130.         PAUSE 1000
  131.         TIMEOUT 5 INITIALIZE2
  132.  
  133. INITIALIZE2:
  134.         SEND "AT^M"
  135.         WAITFOR "OK"
  136.         SEND "AT$INIT^M"
  137.         WAITFOR "OK"
  138.  
  139. START:
  140.         IF '$TYPE' = 'MAN' MANUAL
  141.         IF '$TYPE' = 'DIR' DIRECTORY
  142.         DISPLAYLN "Uknown dial TYPE specified"
  143.         STAMP Unknown dial TYPE specified......Aborting at $TIME on $DATE
  144.         GOTO NORMALOUT
  145.  
  146. MANUAL:
  147.         TIMEOUT 60 MANUAL2              ; Number of seconds to wait for
  148.         WHEN "RING^M" INCOMING
  149.         WHEN "NO CARRIER^M" MANUAL2       ; carrier.  It's a good idea to make
  150.         WHEN "BUSY^M" MANUAL2             ; the timeout higher.  If you keep it
  151.         WHEN "NO DIAL TONE^M" MANUAL2     ; set this way, and set your modem
  152.         WHEN "VOICE^M" MANUAL2            ; to timeout 30 or 45 - then the
  153.                                         ; loop is driven by the WHEN statement
  154.                                         ; instead of the TIMEOUT.
  155.         ASSIGN 2 $DIALS
  156.         INCR 2
  157.  
  158. MANUAL1:
  159.         GOSUB CONFIG_WINDOW
  160.         COLOR 11
  161.         BOX 31,1,80,7
  162.         ATWRITE 33 1 11 "[ Manual Dialing - $DIALS attempts ]"
  163.         WINDOW 33,2,79,6
  164.         COLOR 3
  165. MANUAL2:
  166.         INCR 9
  167.         IF '$9' = '1' NO_WAIT
  168.         IF '$9' = '$2' NO_ANSWER
  169.         DISPLAYLN "  "
  170.         DISPLAY "Pausing $WAIT milliseconds for Re-Dial"
  171.         PAUSE $WAIT
  172. NO_WAIT:
  173.         CLRSCR
  174.         GOSUB CIRCULAR_DIAL
  175.         IF '$9' = '1' NO_CR
  176.         DISPLAYLN "Dial attempt # $9 of $DIALS"
  177.         GOTO CR
  178. NO_CR:
  179.         DISPLAY "Dial attempt # $9 of $DIALS"
  180. CR:
  181.         ' SEND "^M"
  182.         SEND "ATDT$PHONE^M"
  183.         WAITFOR "CONNECT"
  184.         GOTO PICKUP
  185.  
  186. DIRECTORY:
  187.         GOSUB CONFIG_WINDOW
  188.         PAUSE 2000
  189.         DIAL "$PHONE"
  190.         GOTO PICKUP
  191.  
  192. PICKUP:
  193.         GOSUB CLEAR
  194.         COLOR 13
  195.  
  196. PICKUP2:
  197.         TIMEOUT 10 BADCONNECT
  198.         WAITFOR "CONNECT"              ; this is waiting for the CONNECT
  199.                                        ; message from PCBoard. If found it
  200.                                        ; ensures that we are connected at the
  201.                                        ; proper baud rate and aren't getting
  202.                                        ; too much line noise yet.
  203.  
  204. CONTINUE:
  205.         WHEN
  206.         WHEN 'NO CARRIER' CARRIER_LOSS
  207.         TIMEOUT 60 ABORT
  208.         When "[Enter] = Yes" "N Q NS O^M"
  209.         When "[Enter] = No" "N Q NS O^M"
  210.         When "Name" "$NAME $PASSWORD^M"
  211.         IF '$TYPE' = 'MAN' MAN_PWRD
  212.         When 'Password' "$PASSWORD^M"
  213.         GOTO CONT2
  214. MAN_PWRD:
  215.         When "Password" "$PWRD^M"
  216.  
  217. CONT2:
  218.     When "History? [Y/n] :" "N^M"
  219.         When "display " "N^M"
  220.         When "ontinue " "^M"
  221.     WAITFOR "Command :"
  222.  
  223. ImOn:
  224.         Beep 1200
  225.         Beep 1400
  226.         Beep 1200
  227.  
  228. ToNormal:
  229.         When
  230.         TIMEOUT 600 ABORT
  231.         Send "$DOOR^M"
  232.         PAUSE 1000
  233.         DISPLAYLN " "
  234.         Display "Connected to: "
  235.         IF '$TYPE' = 'MAN' DISP2
  236.         Displayln "$BOARD ($HUB) for an HCSNet(tm) Transmission."
  237.         GOTO DISP_CONT
  238.         DISP2:
  239.         Displayln "$HUB for an HCSNet(tm) Transmission."
  240.         DISPLAYLN " "
  241.         GETSCR
  242.  
  243. DISP_CONT:
  244.         WAITFOR ']elect Forums'
  245.         Send "U^M"
  246.         WAITFOR '*'
  247.         UPLOAD $PROT $PATH\$NODEID.REP
  248.         PAUSE 500            ; 1/2 second pause to let receive buffer clear
  249.         When "[Any Key] To Continue" "^M"
  250.         WAITFOR ']elect Forums'
  251.         Send "D^M" 
  252.         WAITFOR '*'
  253.         DOWNLOAD $PROT $PATH\$NODEID.QWK
  254.         WAITFOR ']elect Forums'
  255.         Send "Q^M"
  256.         WHEN 'NO CARRIER' NORMALOUT
  257.         PUTSCR
  258.         WAITFOR "Command :"
  259.         SEND "G^M"
  260.         Waitfor 'NO CARRIER'
  261.         GOTO NORMALOUT
  262.  
  263.  
  264. BADCONNECT:
  265.         PAUSE 1000
  266.         CLRSCR
  267.         INCR G2
  268.         DISPLAYLN "Bad connection with $HUB - RECOVERING..."
  269.         STAMP $TIME - $DATE - Bad connection with $HUB - RECOVERING...
  270.  
  271. BADCONNECT2:
  272.         HANGUP
  273.         IF '$G2' = '$GARBAGE' BAD_ANSWER
  274.         IF '$TYPE' = 'MAN' MANUAL1
  275.         IF '$TYPE' = 'DIR' DIRECTORY
  276.  
  277.  
  278. CARRIER_LOSS:
  279.         HANGUP
  280.         GOSUB CLEAR
  281.         STAMP Aborting transfer due to loss of carrier with $HUB at $TIME on $DATE
  282.         DISPLAYLN "Aborting transfer due to loss of carrier with $HUB at $TIME on $DATE"
  283.         GOTO NORMALOUT
  284.  
  285. ABORT:
  286.         HANGUP
  287.         GOSUB CLEAR
  288.         STAMP ABORTING RELAY TRANSFER AT $TIME ON $DATE DUE TO TIMEOUT ON $HUB
  289.         DISPLAYLN "Aborting transfer at $Time on $Date due to timeout on $HUB"
  290.         GOTO NORMALOUT
  291.  
  292. NO_ANSWER:
  293.         GOSUB CLEAR
  294.         STAMP $HUB failed to answer after $DIALS attempts at $TIME on $DATE
  295.         DISPLAYLN "$HUB failed to answer after $DIALS attempts at $TIME on $DATE"
  296.         GOTO NORMALOUT
  297.  
  298. BAD_ANSWER:
  299.         GOSUB CLEAR
  300.         STAMP Connected with $HUB $GARBAGE times without clean connect at $TIME on $DATE
  301.         DISPLAYLN "Connected with $HUB $GARBAGE times without clean connect at $TIME on $DATE"
  302.         GOTO NORMALOUT
  303.  
  304. NORMALOUT:
  305.         EXIST SP.ERR SEND_LOG
  306.         GOTO SKIP_S
  307.         SEND_LOG:
  308.         STAMP DSZ Reports error on ThrobNet upload at $TIME on $DATE
  309.         DOS "DEL SP.ERR"
  310.         SKIP_S:
  311.         EXIST RP.ERR RECV_LOG
  312.         GOTO SKIP_R
  313.         RECV_LOG:
  314.         STAMP DSZ Reports error on ThrobNet download at $TIME on $DATE
  315.         DOS "DEL RP.ERR"
  316.         SKIP_R:
  317.         TIMEOUT 10 OUTAGAIN
  318.  
  319. OUTAGAIN:
  320.         PAUSE 500
  321.         SEND "ATM0H1^M"
  322.         WAITFOR "OK"
  323.         TURNOFF CAPTURE
  324.         IF '$CALLERS' = '0' FINALOUT
  325.         STAMP Mail script completed on $DATE at $TIME was interrupted by $CALLERS callers
  326. FINALOUT:
  327.         SYSTEM X
  328.  
  329. INCOMING:
  330.         INCR CALLERS
  331.         SEND "ATA^M"
  332.         WAITFOR "CONNECT "
  333.         GETR INBAUD 4
  334.         IF '$BAUDRATE' = '0' NO_SHIFT
  335.         DISPLAYLN 'Shifting to callers baud rate - $INBAUD'
  336.         SETCOMM $INBAUD
  337. NO_SHIFT:
  338.         PAUSE 3000
  339.         ASSIGN TEXT "^GThe board is currently attempting to dial out"
  340.         SEND '$TEXT^M^J'
  341.         DISPLAYLN "$TEXT"
  342.         ASSIGN TEXT "for a HCSNet(tm) mail transfer. Please call"
  343.         SEND '$TEXT^M^J'
  344.         DISPLAYLN '$TEXT'
  345.         ASSIGN TEXT "back in 30 minutes. Thank you."
  346.         SEND '$TEXT^M^J'
  347.         DISPLAYLN '$TEXT'
  348.         ASSIGN TEXT ' '
  349.         SEND '$TEXT^M^J'
  350.         PAUSE 5000
  351.         HANGUP
  352.         IF '$BAUDRATE' = '0' NO_RESET
  353.         DISPLAYLN 'Re-setting baud rate to $BAUDRATE'
  354.         SETCOMM $BAUDRATE
  355.  
  356. NO_RESET:
  357.         SEND "AT$INIT^M"
  358.         WAITFOR "OK"
  359.         GOTO MANUAL2
  360.  
  361. CONFIG_WINDOW:
  362.         WINDOW 1,1,80,24
  363.         CLRSCR
  364.         COLOR 11
  365.         BOX 1,1,30,15
  366.         ATWRITE 3 1 11 "[ Configuration ]"
  367.         COLOR 3
  368.         WINDOW 3,3,29,14
  369.         DISPLAYLN "Name:   $NAME"
  370.         DISPLAYLN "Door:   $DOOR"
  371.         DISPLAYLN "NODEID: $NODEID"
  372.         DISPLAYLN "Path:   $PATH"
  373.         DISPLAYLN "Init:   $INIT"
  374.         DISPLAYLN "Type:   $TYPE"
  375.         DISPLAYLN "Phone:  $PHONE"
  376.         DISPLAYLN "PWRD:   ********"
  377.         DISPLAYLN "HUB:    $HUB"
  378.         DISPLAYLN "Dials:  $DIALS"
  379.         DISPLAY "WAIT:   $WAIT"
  380. RETURN
  381.  
  382. CLEAR:
  383.         WINDOW 1,1,80,24
  384.         CLRSCR
  385. RETURN
  386.  
  387. CIRCULAR_DIAL:
  388.   INCR CIRCNUM
  389.   IF '$CIRCNUM' > '9' ResetCirc
  390. BackFromReset:
  391.   IF '$CIRCNUM' = '1' Stuff1
  392.   IF '$CIRCNUM' = '2' Stuff2
  393.   IF '$CIRCNUM' = '3' Stuff3
  394.   IF '$CIRCNUM' = '4' Stuff4
  395.   IF '$CIRCNUM' = '5' Stuff5
  396.   IF '$CIRCNUM' = '6' Stuff6
  397.   IF '$CIRCNUM' = '7' Stuff7
  398.   IF '$CIRCNUM' = '8' Stuff8
  399.   IF '$CIRCNUM' = '9' Stuff9
  400. BackFromStuff:
  401.   ATWRITE 11 9 11 "$PHONE"
  402. RETURN
  403.  
  404. Stuff1:
  405.   IF '$P1' = '' ResetCirc
  406.   ASSIGN PHONE '$P1'
  407.   GOTO BackFromStuff
  408. Stuff2:
  409.   IF '$P2' = '' ResetCirc
  410.   ASSIGN PHONE '$P2'
  411.   GOTO BackFromStuff
  412. Stuff3:
  413.   IF '$P3' = '' ResetCirc
  414.   ASSIGN PHONE '$P3'
  415.   GOTO BackFromStuff
  416. Stuff4:
  417.   IF '$P4' = '' ResetCirc
  418.   ASSIGN PHONE '$P4'
  419.   GOTO BackFromStuff
  420. Stuff5:
  421.   IF '$P5' = '' ResetCirc
  422.   ASSIGN PHONE '$P5'
  423.   GOTO BackFromStuff
  424. Stuff6:
  425.   IF '$P6' = '' ResetCirc
  426.   ASSIGN PHONE '$P6'
  427.   GOTO BackFromStuff
  428. Stuff7:
  429.   IF '$P7' = '' ResetCirc
  430.   ASSIGN PHONE '$P7'
  431.   GOTO BackFromStuff
  432. Stuff8:
  433.   IF '$P8' = '' ResetCirc
  434.   ASSIGN PHONE '$P8'
  435.   GOTO BackFromStuff
  436. Stuff9:
  437.   IF '$P9' = '' ResetCirc
  438.   ASSIGN PHONE '$P9'
  439.   GOTO BackFromStuff
  440. ResetCirc:
  441.   ASSIGN CIRCNUM 1
  442.   GOTO BackFromReset
  443.