home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / WINDOWS / DATACOM / RFDML112 / CSERVE.SCR < prev    next >
Text File  |  1993-11-18  |  19KB  |  693 lines

  1. ;------------------------------------------------------
  2. ;
  3. ;CSERVE.SCR --- The script file for CompuServe
  4. ;
  5. ;------------------------------------------------------
  6. ;
  7. ;   We begin with the format specifiers to which allow
  8. ;the script to identify where the MailId, RealName,
  9. ;and Subject texts are in a newly downloaded letter.
  10. ;
  11. Format
  12. Reply to: $SUBJECT$\n
  13. Subject: $SUBJECT$\n
  14. Subj: $SUBJECT$\n
  15. From: [$UID$] $NAME$\n
  16. From: $NAME$[$UID$]
  17. From: $NAME$>$UID$\n
  18. From: $UID$\n
  19. Endformat
  20. ;
  21. ;------------------------------------------------------
  22. ; The following is a set of aliases which define the
  23. ; various prompts that CIS will send.
  24. ;
  25. Alias cishost 'Host Name:'
  26. Alias cisprompt 'Enter choice'
  27. Alias loginprompt '\nUser ID: '
  28. Alias passwdprompt '\nPassword:'
  29. Alias presscr 'Press <CR>!'
  30. ;
  31. ; The following aliases define the banner lines for
  32. ; various areas of the CIS system
  33. ;
  34. Alias mailmenubanner 'Mail  Main Menu'
  35. Alias msgmenubanner '\nCompuServe Mail  Message Menu'
  36. ;
  37. ;------------------------------------------------------
  38. ; The following alias determines what intermediate network
  39. ; will be assumed.  It can be one of the following:
  40. ;
  41. ;    DIRECT    Direct connection to CIS Packet Net
  42. ;    SPRINT    Connect through SprintNet
  43. ;    TYMNET    Connect through TymNet
  44. ;
  45. Alias connectype DIRECT
  46. ;
  47. ; The following alias should be set TRUE if your modem
  48. ; drops carrier every time you make a connection.  This
  49. ; alias simply forces the script to wait 2 seconds for
  50. ; the connection to settle before starting the script.
  51. ;
  52. Alias waitasec FALSE
  53. ;
  54. ;------------------------------------------------------
  55. ; The following aliases cause the script to use
  56. ; XMODEM for the transfer protocol.  Comment them
  57. ; out if you wish to use ASCII instead:
  58. ;
  59. Alias dnloadproto REQUEST_XMODEM_DNLOAD
  60. Alias uploadproto REQUEST_UPLOAD_XMODEM
  61. ;
  62. ; Uncomment the following aliases if you wish to
  63. ; use ASCII transfers:
  64. ;
  65. ;Alias dnloadproto REQUEST_ASCII_DNLOAD
  66. ;Alias uploadproto REQUEST_UPLOAD_ASCII
  67. ;
  68. ;------------------------------------------------------
  69. ; This is the main entry-point for the script, which
  70. ; decides which intermediate network will be used to
  71. ; connect to CompuServe.
  72. ;
  73. Begin START
  74.    If %waitasec% Then WAIT_START
  75.    If TRUE Then %connectype%
  76. End
  77. Begin WAIT_START
  78.    Timeout 2 Goto %connectype%
  79. End
  80. ;
  81. ;------------------------------------------------------
  82. ; This is the entry point for a direct dial-in to CIS
  83. ; Packet Net.  Basically it begins by sending a Control-C
  84. ; every three seconds until we see a 'User ID' prompt.
  85. ;
  86. Begin DIRECT
  87.    Caption 'connected'
  88.    Control C
  89.    When %cishost% Goto CIS_HOST
  90.    When %loginprompt% Goto USERNAME
  91.    Timeout 3 Goto DIRECT
  92. End
  93. ;------------------------------------------------------
  94. ; This is the entry point for a dial-in to CIS via
  95. ; SprintNet.
  96. ;
  97. Alias sprintterm 'TERMINAL='
  98. Begin SPRINT
  99.    Timeout 2 Goto SPRINT0
  100. End
  101. Begin SPRINT0
  102.    Caption 'connected'
  103.    Transmit '@'
  104.    Timeout 1 Goto SPRINTCR
  105. End
  106. Begin SPRINTCR
  107.    Cr
  108.    When %sprintterm% Goto SPRINT_TERM
  109.    CarrierLoss Goto NO_LOGIN
  110.    Timeout 8 Goto SPRINT1
  111. End
  112. Begin SPRINT1
  113.    Transmit '@'
  114.    Timeout 1 Goto SPRINTCR1
  115. End
  116. Begin SPRINTCR1
  117.    Cr
  118.    When %sprintterm% Goto SPRINT_TERM
  119.    CarrierLoss Goto NO_LOGIN
  120.    Timeout 8 Goto SPRINT2
  121. End
  122. Begin SPRINT2
  123.    Transmit '@'
  124.    Timeout 1 Goto SPRINTCR2
  125. End
  126. Begin SPRINTCR2
  127.    Cr
  128.    When %sprintterm% Goto SPRINT_TERM
  129.    CarrierLoss Goto NO_LOGIN
  130.    Timeout 30 Goto NO_LOGIN
  131. End
  132. Begin SPRINT_TERM
  133.    Transmit 'D1'
  134.    Cr
  135.    When '@' Goto SPRINT_LOGIN
  136.    When %sprintterm% Goto SPRINT_TERM
  137.    Timeout 30 Goto NO_LOGIN
  138. End
  139. Begin SPRINT_LOGIN
  140.    Transmit 'C 614227'
  141.    Cr
  142.    When %cishost% Goto CIS_HOST
  143.    When %loginprompt% Goto USERNAME
  144.    When '@' Goto SPRINT_LOGIN2
  145.    Timeout 45 Goto NO_LOGIN
  146. End
  147. Begin SPRINT_LOGIN2
  148.    Transmit 'C 202202'
  149.    Cr
  150.    When %cishost% Goto CIS_HOST
  151.    When %loginprompt% Goto USERNAME
  152.    Timeout 45 Goto NO_LOGIN
  153. End
  154. ;------------------------------------------------------
  155. ; This is the entry point for a dial-in to CIS via
  156. ; TymNet.
  157. ;
  158. Alias tymterm 'terminal identifier'
  159. Alias tymlogin 'please log in'
  160. Alias tymcis 'CML05'
  161. Begin TYMNET
  162.    Caption 'connected'
  163.    When %tymterm% Goto TYMNET_TERM
  164.    CarrierLoss Goto NO_LOGIN
  165.    Timeout 5 Goto TYMNET1
  166. End
  167. Begin TYMNET1
  168.    Cr
  169.    When %tymterm% Goto TYMNET_TERM
  170.    CarrierLoss Goto NO_LOGIN
  171.    Timeout 5 Goto TYMNET2
  172. End
  173. Begin TYMNET2
  174.    Cr
  175.    When %tymterm% Goto TYMNET_TERM
  176.    CarrierLoss Goto NO_LOGIN
  177.    Timeout 15 Goto NO_LOGIN
  178. End
  179. Begin TYMNET_TERM
  180.    Transmit 'A'
  181.    When %tymlogin% Goto TYMNET_LOGIN
  182.    When %tymterm% Goto TYMNET_TERM
  183.    CarrierLoss Goto NO_LOGIN
  184.    Timeout 15 Goto NO_LOGIN
  185. End
  186. Begin TYMNET_LOGIN
  187.    Transmit %tymcis%
  188.    Cr
  189.    When %tymlogin% Goto TYMNET_LOGIN
  190.    When %cishost% Goto CIS_HOST
  191.    When %loginprompt% Goto USERNAME
  192.    CarrierLoss Goto NO_LOGIN
  193.    Timeout 45 Goto NO_LOGIN
  194. End
  195. ;
  196. ;------------------------------------------------------
  197. ; These states perform the login process into CIS
  198. ;
  199. Begin CIS_HOST
  200.    Transmit 'CIS,DOMESTIC'
  201.    Cr
  202.    When %cishost% Goto CIS_HOST
  203.    When %loginprompt% Goto USERNAME
  204.    Timeout 45 Goto NO_LOGIN
  205. End
  206. Begin USERNAME
  207.    Caption 'logging in'
  208.    Transmit $USERNAME
  209.    Cr
  210.    When %passwdprompt% Goto PASSWORD
  211.    When %loginprompt% Goto USERNAME
  212.    Timeout 20 Goto NO_LOGIN
  213. End
  214. Begin PASSWORD
  215.    Transmit $PASSWORD
  216.    Cr
  217.    When %passwdprompt% Goto PASSWORD
  218.    When %loginprompt% Goto USERNAME
  219.    When 'CompuServe Information Service' Goto LOGGED_IN
  220.    Timeout 20 Goto NO_LOGIN
  221. End
  222. Begin LOGGED_IN
  223.    Caption 'logged in'
  224.    When %msgmenubanner% Goto MESSAGE_MENU
  225.    When 'New This Week' Goto NEW_MENU
  226.    When %cisprompt% Goto JUMP_TO_MAIL
  227.    Timeout 30 Goto JUMP_TO_MAIL
  228. End
  229. Begin NEW_MENU
  230.    When %cisprompt% Goto JUMP_TO_MAIL
  231.    Timeout 20 Goto JUMP_TO_MAIL
  232. End
  233. ;------------------------------------------------------
  234. ; These states deal with getting from wherever we are
  235. ; into the CIS Mail Area.
  236. ;
  237. Begin JUMP_TO_MAIL
  238.    Transmit 'go email'
  239.    Cr
  240.    When 'Mail  Message Menu' Goto MESSAGE_MENU
  241.    When 'additional information (Y or N)!' Goto ANSWER_NO
  242.    When 'is temporarily unavailable' Goto MAIL_UNAVAILABLE
  243.    When %mailmenubanner% Goto MAIL_MAIN_MENU
  244.    When %cisprompt% Goto JUMP_TO_MAIL
  245.    Timeout 20 Goto GIVE_UP
  246. End
  247. Begin ANSWER_NO
  248.    Transmit 'N'
  249.    Cr
  250.    When 'Mail  Message Menu' Goto MESSAGE_MENU
  251.    When 'additional information (Y or N)!' Goto ANSWER_NO
  252.    When %mailmenubanner% Goto MAIL_MAIN_MENU
  253.    When %cisprompt% Goto JUMP_TO_MAIL
  254.    Timeout 20 Goto GIVE_UP
  255. End
  256. ;------------------------------------------------------
  257. ; At this point we're entering the main menu of the
  258. ; mail area.  These states detect if there's mail,
  259. ; and if there is it initiates a download of the next
  260. ; letter in line.  If not, and there are more letters
  261. ; to deliver, an upload is initiated
  262. ;
  263. Begin MAIL_MAIN_MENU
  264.    Caption 'Mail Area'
  265.    When '*** No mail waiting ***' Goto NO_MAIL_WAITING
  266.    When 'letters waiting' Goto MAIL_WAITING
  267.    When 'letter waiting' Goto MAIL_WAITING
  268.    When 'message pending' Goto MAIL_WAITING
  269.    When 'messages pending' Goto MAIL_WAITING
  270.    When %cisprompt% Goto JUMP_TO_MAIL
  271.    Timeout 20 Goto GIVE_UP
  272. End
  273. Begin MAIL_WAITING
  274.    If FETCHING Then FETCH_FROM_MAIN_MENU
  275.    If MORE_LETTERS Then SEND_MAIL
  276.    When %cisprompt% Goto LOG_OFF
  277.    Timeout 20 Goto LOG_OFF
  278. End
  279. Begin NO_MAIL_WAITING
  280.    Caption 'No Mail'
  281.    If MORE_LETTERS Then SEND_MAIL
  282.    When %cisprompt% Goto LOG_OFF
  283.    Timeout 20 Goto GIVE_UP
  284. End
  285. ;------------------------------------------------------
  286. ; These states are run when the silly "Message Menu"
  287. ; appears at login time.  If the script is fetching
  288. ; mail, it will initiate a download of a letter from
  289. ; this menu.  Note that only one letter will be downloaded,
  290. ; if there are more, the script gets the rest from the
  291. ; normal Mail Menu.
  292. ;
  293. Begin MESSAGE_MENU
  294.    Caption 'You have mail'
  295.    If FETCHING Then FETCH_FROM_MESSAGE_MENU
  296.    When 'M for CompuServe Mail' Goto JUMP_TO_MAIL
  297.    Timeout 15 Goto JUMP_TO_MAIL
  298. End
  299. Begin FETCH_FROM_MESSAGE_MENU
  300.    When %cisprompt% Goto JUMP_TO_MAIL
  301.    When 'M for CompuServe Mail' Goto %dnloadproto%
  302.    Timeout 15 Goto %dnloadproto%
  303. End
  304. ;------------------------------------------------------
  305. ; These states initiate a download of a letter, instruct
  306. ; RFD Mail to put the new letter into the In Box, then
  307. ; delete the letter on the CIS side.
  308. ;
  309. Begin FETCH_FROM_MAIN_MENU
  310.    When %cisprompt% Goto %dnloadproto%
  311.    Timeout 15 Goto %dnloadproto%
  312. End
  313. Begin REQUEST_XMODEM_DNLOAD
  314.    Caption 'Fetching Mail'
  315.    Transmit 'download/PRO:XMODEM 1'
  316.    Cr
  317.    When 'characters ready' Goto PAUSE_BEFORE_DOWNLD
  318.    When 'for download' Goto PAUSE_BEFORE_DOWNLD
  319.    When 'Starting XMODEM' Goto PAUSE_BEFORE_DOWNLD
  320.    When %cisprompt% Goto JUMP_TO_MAIL
  321.    Timeout 20 Goto ABORT_DOWNLD
  322. End
  323. Begin ABORT_DOWNLD
  324.    Control X
  325.    Control X
  326.    Control X
  327.    Control X
  328.    Control X
  329.    Control X
  330.    Control X
  331.    Control C
  332.    When 'Press CR!' Goto JUMP_TO_MAIL
  333.    Timeout 20 Goto JUMP_TO_MAIL
  334. End
  335. Begin PAUSE_BEFORE_DOWNLD
  336.    Timeout 2 Goto DOWNLD_XMODEM
  337. End
  338. Begin DOWNLD_XMODEM
  339.    Download XMODEM Then DOWNLD_SUCCESS_XMODEM Else GIVE_UP
  340. End
  341. Begin DOWNLD_SUCCESS_XMODEM
  342.    Confirm LETTER.RECEIVED Successful
  343.    Caption 'Letter Received'
  344.    When 'Transfer Completed' Goto WAIT_DOWNLD_CR
  345.    When %presscr% Goto SEND_DOWNLD_CR
  346.    When 'Message Menu' Goto WAIT_DELETE_LETTER
  347.    Timeout 5 Goto SEND_DOWNLD_CR
  348. End
  349. Begin REQUEST_ASCII_DNLOAD
  350.    Caption 'Fetching Mail'
  351.    Transmit 'download/PRO:CAPTURE 1'
  352.    Cr
  353.    When 'capture buffer...' Goto DOWNLD_ASCII
  354.    When %cisprompt% Goto JUMP_TO_MAIL
  355.    Timeout 20 Goto DOWNLD_ASCII
  356. End
  357. Begin DOWNLD_ASCII
  358.    Download ASCII 'Capture buffer closed' Then DOWNLD_SUCCESS_ASCII Else GIVE_UP
  359. End
  360. Begin DOWNLD_SUCCESS_ASCII
  361.    Confirm LETTER.RECEIVED Successful
  362.    Caption 'Letter Received'
  363.    Cr
  364.    When 'Message Menu' Goto WAIT_DELETE_LETTER
  365.    When %presscr% Goto SEND_DOWNLD_CR
  366.    When %mailmenubanner% Goto WAIT_DELETE_LETTER
  367.    Timeout 10 Goto SEND_DOWNLD_CR
  368. End
  369. Begin WAIT_DOWNLD_CR
  370.    When %presscr% Goto SEND_DOWNLD_CR
  371.    Timeout 5 Goto SEND_DOWNLD_CR
  372. End
  373. Begin SEND_DOWNLD_CR
  374.    Cr
  375.    When %presscr% Goto SEND_DOWNLD_CR
  376.    When %mailmenubanner% Goto WAIT_DELETE_LETTER
  377.    When 'M for CompuServe' Goto DELETE_LETTER
  378.    Timeout 20 Goto RETRY_DELETE_LETTER
  379. End
  380. Begin WAIT_DELETE_LETTER
  381.    When %cisprompt% Goto DELETE_LETTER
  382.    When 'for CompuServe Mail main menu' Goto DELETE_LETTER
  383.    Timeout 15 Goto RETRY_DELETE_LETTER
  384. End
  385. Begin RETRY_DELETE_LETTER
  386.    Transmit 'go email'
  387.    Cr
  388.    When %mailmenubanner% Goto WAIT_DELETE_LETTER
  389.    When %cisprompt% Goto DELETE_LETTER
  390.    Timeout 15 Goto GIVE_UP
  391. End
  392. Begin DELETE_LETTER
  393.    Caption 'Deleting Letter'
  394.    Transmit 'delete 1'
  395.    Cr
  396.    When %presscr% Goto SEND_DELETE_CR
  397.    When 'M for CompuServe Mail' Goto JUMP_TO_MAIL
  398.    Timeout 10 Goto SEND_DELETE_CR
  399. End
  400. Begin SEND_DELETE_CR
  401.    Cr
  402.    When 'M for CompuServe Mail' Goto JUMP_TO_MAIL
  403.    When %mailmenubanner% Goto MAIL_MAIN_MENU
  404.    When %cisprompt% Goto JUMP_TO_MAIL
  405.    Timeout 10 Goto JUMP_TO_MAIL
  406. End
  407. ;------------------------------------------------------
  408. ; These states are executed for each letter to be
  409. ; sent.  First the current letter is uploaded, then
  410. ; it is addressed, then finally the delivery is
  411. ; confirmed.
  412. ;
  413. Begin SEND_MAIL
  414.    When %cisprompt% Goto %uploadproto%
  415.    Timeout 20 Goto GIVE_UP
  416. End
  417. Begin REQUEST_UPLOAD_XMODEM
  418.    Transmit 'UPLOAD/TYP:ASC/PRO:XMODEM'
  419.    Cr
  420.    When %cisprompt% Goto REQUEST_UPLOAD_XMODEM
  421.    When 'Starting XMODEM' Goto PAUSE_BEFORE_UPLOAD
  422.    When 'XMODEM transfer' Goto PAUSE_BEFORE_UPLOAD
  423.    When 'Key <CR>' Goto PAUSE_BEFORE_UPLOAD
  424.    Timeout 20 Goto GIVE_UP
  425. End
  426. Begin PAUSE_BEFORE_UPLOAD
  427.    NewLetter
  428.    Timeout 2 Goto BEGIN_XMODEM_UPLOAD
  429. End
  430. Begin BEGIN_XMODEM_UPLOAD
  431.    Upload XMODEM Then UPLOAD_XMODEM_SUCCESS Else GIVE_UP
  432. End
  433. Begin UPLOAD_XMODEM_SUCCESS
  434.    Caption 'Letter Uploaded'
  435.    When '*** File Transfer Completed! ***' Goto END_LETTER_UPLOAD
  436.    When %presscr% Goto REQUEST_SEND_MENU
  437.    When 'CompuServe Mail  Send Menu' Goto MAIL_SEND_MENU
  438.    Timeout 10 Goto REQUEST_SEND_MENU
  439. End
  440. Begin REQUEST_UPLOAD_ASCII
  441.    Transmit 'UPLOAD/TYP:ASC/PRO:CAPTURE'
  442.    Cr
  443.    When %cisprompt% Goto REQUEST_UPLOAD_ASCII
  444.    When 'prompted for each line (Y/N)?' Goto CONFIRM_UPLOAD_ASCII
  445.    Timeout 20 Goto GIVE_UP
  446. End
  447. Begin CONFIRM_UPLOAD_ASCII
  448.    Transmit 'N'
  449.    Cr
  450.    When 'prompted for each line (Y/N)?' Goto CONFIRM_UPLOAD_ASCII
  451.    When 'the end of your data.' Goto BEGIN_ASCII_UPLOAD
  452.    Timeout 20 Goto GIVE_UP
  453. End
  454. Begin BEGIN_ASCII_UPLOAD
  455.    NewLetter
  456.    Upload ASCII Then UPLOAD_ASCII_SUCCESS Else GIVE_UP
  457. End
  458. Begin UPLOAD_ASCII_SUCCESS
  459.    Caption 'Letter Uploaded'
  460.    Control Z
  461.    When '*** File Transfer Completed! ***' Goto END_LETTER_UPLOAD
  462.    When %presscr% Goto REQUEST_SEND_MENU
  463.    When 'CompuServe Mail  Send Menu' Goto MAIL_SEND_MENU
  464.    Timeout 10 Goto REQUEST_SEND_MENU
  465. End
  466. Begin END_LETTER_UPLOAD
  467.    When %presscr% Goto REQUEST_SEND_MENU
  468.    Timeout 20 Goto GIVE_UP
  469. End
  470. Begin REQUEST_SEND_MENU
  471.    Cr
  472.    When %presscr% Goto REQUEST_SEND_MENU
  473.    When 'CompuServe Mail  Send Menu' Goto MAIL_SEND_MENU
  474.    When 'For current message' Goto MAIL_SEND_MENU
  475.    Timeout 20 Goto GIVE_UP
  476. End
  477. Begin MAIL_SEND_MENU
  478.    When %cisprompt% Goto REQUEST_LETTER_SEND
  479.    Timeout 20 Goto GIVE_UP
  480. End
  481. Begin REQUEST_LETTER_SEND
  482.    Transmit '1'
  483.    Cr
  484.    When 'CompuServe Mail  Send Menu' Goto MAIL_SEND_MENU
  485.    When %cisprompt% Goto REQUEST_LETTER_SEND
  486.    When 'to (Name or User ID): ' Goto SEND_DEST_USERNAME
  487.    Timeout 20 Goto GIVE_UP
  488. End
  489. Begin SEND_DEST_USERNAME
  490.    Caption 'Sending Letter'
  491.    Transmit $LETTER.DEST.USERNAME
  492.    If LETTER.CC Then BEGIN_CC
  493.    Cr
  494.    When 'Subject: ' Goto SEND_SUBJECT
  495.    When 'to (Name or User ID): ' Goto SEND_DEST_USERNAME
  496.    When 'Enter correction or <CR> to omit:' Goto BAD_ADDRESS
  497.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  498.    Timeout 20 Goto GIVE_UP
  499. End
  500. Begin SEND_SUBJECT
  501.    Transmit (40) $LETTER.SUBJECT
  502.    Cr
  503.    When 'Subject: ' Goto SEND_SUBJECT
  504.    When 'Your name: ' Goto SEND_REAL_NAME
  505.    When 'address correct? (Y or N)! ' Goto CONFIRM_LETTER
  506.    Timeout 20 Goto GIVE_UP
  507. End
  508. Begin BEGIN_CC
  509.    Caption 'Sending CC'
  510.    Transmit ';'
  511.    Cr
  512.    CreateCC 50 80 Delimiter ';;'
  513.    When 'Also send to?:' Goto SEND_CC
  514.    Timeout 20 Goto GIVE_UP
  515. End
  516. Begin SEND_CC
  517.    Transmit $LETTER.CC
  518.    Cr
  519.    If LETTER.CC Then CONTINUE_CC
  520.    When 'Also send to?:' Goto SEND_CC
  521.    When 'Subject: ' Goto SEND_SUBJECT
  522.    When 'Enter correction or <CR> to omit:' Goto BAD_ADDRESS
  523.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  524.    Timeout 20 Goto GIVE_UP
  525. End
  526. Begin CONTINUE_CC
  527.    Caption 'Sending CC...'
  528.    CreateCC 50 80 Delimiter ';;'
  529.    When 'Also send to?:' Goto SEND_CC
  530.    Timeout 20 Goto GIVE_UP
  531. End
  532. Begin SEND_REAL_NAME
  533.    Transmit $YOURNAME
  534.    Cr
  535.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  536.    When 'Your name: ' Goto SEND_REAL_NAME
  537.    When 'or N) !' Goto ANSWER2_YES
  538.    Timeout 20 Goto GIVE_UP
  539. End
  540. Begin ANSWER2_YES
  541.    Transmit 'Y'
  542.    Cr
  543.    When 'address correct? (Y or N)! ' Goto CONFIRM_LETTER
  544.    Timeout 20 Goto GIVE_UP
  545. End
  546. Begin CONFIRM_LETTER
  547.    Transmit 'Y'
  548.    Cr
  549.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  550.    When 'Message sent to ' Goto LETTER_SEND_CONFIRMED
  551.    Timeout 20 Goto GIVE_UP
  552. End
  553. Begin LETTER_SEND_CONFIRMED
  554.    Confirm LETTER.SENT Successful
  555.    Caption 'Letter Delivered'
  556.    When %presscr% Goto BACK_TO_MAIL_MENU
  557.    Timeout 20 Goto GIVE_UP
  558. End
  559. ;------------------------------------------------------
  560. ; These states deal with recovering from a bad address
  561. ; or CC, then put us back into the main Mail area.
  562. ;
  563. Begin BAD_ADDRESS
  564.     Caption 'Unknown Address'
  565.     Cr
  566.     When 'Subject:' Goto SEND_NULL_SUBJ
  567.     When %cisprompt% Goto LETTER_ABORTED
  568.     Timeout 30 Goto GIVE_UP
  569. End
  570. Begin SEND_NULL_SUBJ
  571.     Cr
  572.     When %presscr% Goto SEND_CR_ABORT
  573.     When %cisprompt% Goto LETTER_ABORTED
  574.     Timeout 20 Goto GIVE_UP
  575. End
  576. Begin SEND_CR_ABORT
  577.     Cr
  578.     When %presscr% Goto SEND_CR_ABORT
  579.     When %cisprompt% Goto LETTER_ABORTED
  580.     Timeout 20 Goto GIVE_UP
  581. End
  582. Begin LETTER_ABORTED
  583.     Caption 'Letter NOT Delivered'
  584.     Cr
  585.     Confirm LETTER.SENT Unsuccessful
  586.     When 'CompuServe Mail  Main Menu' Goto MAIL_MAIN_MENU
  587.     When %presscr% Goto BACK_TO_MAIL_MENU
  588.     When %cisprompt% Goto JUMP_TO_MAIL
  589.     Timeout 20 Goto JUMP_TO_MAIL
  590. End
  591. ;------------------------------------------------------
  592. ; This is where we check to see if we have more letters
  593. ; to send before we log off.  If so, we jump back to the
  594. ; main Mail Menu.
  595. ;
  596. Begin BACK_TO_MAIL_MENU
  597.    Cr
  598.    If MORE_LETTERS Then PREPARE_TO_SEND_MORE
  599.    When 'CompuServe Mail  Main Menu' Goto WAIT_TO_LOG_OFF
  600.    When %presscr% Goto BACK_TO_MAIL_MENU
  601.    When %cisprompt% Goto LOG_OFF
  602.    Timeout 20 Goto GIVE_UP
  603. End
  604. Begin PREPARE_TO_SEND_MORE
  605.    When 'CompuServe Mail  Main Menu' Goto MAIL_MAIN_MENU
  606.    When %presscr% Goto BACK_TO_MAIL_MENU
  607.    When %cisprompt% Goto JUMP_TO_MAIL
  608.    Timeout 20 Goto JUMP_TO_MAIL
  609. End
  610. ;------------------------------------------------------
  611. ; These states will be run if we get a "mail system down"
  612. ; response when the script attempts to go into the
  613. ; Mail area.
  614. ;
  615. Begin MAIL_UNAVAILABLE
  616.    Caption 'Mail System Down'
  617.    When %presscr% Goto MAIL_UNAVAILABLE_CR
  618.    Timeout 20 Goto GIVE_UP
  619. End
  620. Begin MAIL_UNAVAILABLE_CR
  621.    Cr
  622.    When %cisprompt% Goto LOG_OFF
  623.    Timeout 20 Goto GIVE_UP
  624. End
  625. ;------------------------------------------------------
  626. ; These states deal with logging off the system
  627. ;
  628. Begin WAIT_TO_LOG_OFF
  629.    When %cisprompt% Goto LOG_OFF
  630.    Timeout 20 Goto GIVE_UP
  631. End
  632. Begin LOG_OFF
  633.    Transmit 'off'
  634.    Cr
  635.    Caption 'Logging off'
  636.    When 'NO CAR' Goto EXIT_PROGRAM
  637.    When 'Disconnected' Goto HANGUP
  638.    When 'DISCONNECTED' Goto HANGUP
  639.    When %tymlogin% Goto HANGUP
  640.    When 'Do you wish to exit CompuServe Mail anyway?' Goto CONFIRM_LOGOFF
  641.    When %cisprompt% Goto LOG_OFF
  642.    CarrierLoss Goto EXIT_PROGRAM
  643.    Timeout 20 Goto SPRINT_BYE
  644. End
  645. Begin CONFIRM_LOGOFF
  646.    Transmit 'Y'
  647.    Cr
  648.    When 'NO CAR' Goto EXIT_PROGRAM
  649.    When 'Disconnected' Goto HANGUP
  650.    When 'DISCONNECTED' Goto HANGUP
  651.    When %tymlogin% Goto HANGUP
  652.    When 'Do you wish to exit CompuServe Mail anyway?' Goto CONFIRM_LOGOFF
  653.    When %cisprompt% Goto LOG_OFF
  654.    CarrierLoss Goto EXIT_PROGRAM
  655.    Timeout 20 Goto SPRINT_BYE
  656. End
  657. Begin SPRINT_BYE
  658.    Cr
  659.    Transmit '@'
  660.    Cr
  661.    When '@' Goto SPRINT_DISC
  662.    CarrierLoss Goto EXIT_PROGRAM
  663.    Timeout 10 Goto HANGUP
  664. End
  665. Begin SPRINT_DISC
  666.    Transmit 'D'
  667.    Cr
  668.    CarrierLoss Goto EXIT_PROGRAM
  669.    Timeout 5 Goto HANGUP
  670. End
  671. Begin EXIT_PROGRAM
  672.    Caption 'Logged off'
  673.    CarrierLoss Goto EXIT_PROGRAM
  674.    Timeout 3 Goto BYE_BYE
  675. End
  676. Begin HANGUP
  677.    Hangup
  678.    CarrierLoss Goto EXIT_PROGRAM
  679. End
  680. Begin GIVE_UP
  681.    Caption 'Aborting'
  682.    Hangup
  683.    CarrierLoss Goto EXIT_PROGRAM
  684. End
  685. Begin NO_LOGIN
  686.    Caption 'login failed'
  687.    Timeout 5 Goto EXIT_PROGRAM
  688. End
  689. Begin BYE_BYE
  690.    Exit
  691. End
  692.  
  693.