home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / WIN_UTL2 / RFDMAIL.ZIP / CSERVE.SCR < prev    next >
Text File  |  1994-01-18  |  20KB  |  703 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.    If LETTER.RECEIPT Then SEND_RECEIPT
  483.    Transmit 'SEND'
  484.    Cr
  485.    When 'CompuServe Mail  Send Menu' Goto MAIL_SEND_MENU
  486.    When %cisprompt% Goto REQUEST_LETTER_SEND
  487.    When 'to (Name or User ID): ' Goto SEND_DEST_USERNAME
  488.    Timeout 20 Goto GIVE_UP
  489. End
  490. Begin SEND_RECEIPT
  491.    Caption 'Sending Receipt'
  492.    Transmit 'SEND/REC'
  493.    Cr
  494.    When 'CompuServe Mail  Send Menu' Goto MAIL_SEND_MENU
  495.    When %cisprompt% Goto REQUEST_LETTER_SEND
  496.    When 'to (Name or User ID): ' Goto SEND_DEST_USERNAME
  497.    Timeout 20 Goto GIVE_UP
  498. End
  499. Begin SEND_DEST_USERNAME
  500.    Caption 'Sending Letter'
  501.    Transmit $LETTER.DEST.USERNAME
  502.    If LETTER.CC Then BEGIN_CC
  503.    Cr
  504.    When 'Subject: ' Goto SEND_SUBJECT
  505.    When 'to (Name or User ID): ' Goto SEND_DEST_USERNAME
  506.    When 'Enter correction or <CR> to omit:' Goto BAD_ADDRESS
  507.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  508.    Timeout 20 Goto GIVE_UP
  509. End
  510. Begin SEND_SUBJECT
  511.    Transmit (40) $LETTER.SUBJECT
  512.    Cr
  513.    When 'Subject: ' Goto SEND_SUBJECT
  514.    When 'Your name: ' Goto SEND_REAL_NAME
  515.    When 'address correct? (Y or N)! ' Goto CONFIRM_LETTER
  516.    Timeout 20 Goto GIVE_UP
  517. End
  518. Begin BEGIN_CC
  519.    Caption 'Sending CC'
  520.    Transmit ';'
  521.    Cr
  522.    CreateCC 50 80 Delimiter ';;'
  523.    When 'Also send to?:' Goto SEND_CC
  524.    Timeout 20 Goto GIVE_UP
  525. End
  526. Begin SEND_CC
  527.    Transmit $LETTER.CC
  528.    Cr
  529.    If LETTER.CC Then CONTINUE_CC
  530.    When 'Also send to?:' Goto SEND_CC
  531.    When 'Subject: ' Goto SEND_SUBJECT
  532.    When 'Enter correction or <CR> to omit:' Goto BAD_ADDRESS
  533.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  534.    Timeout 20 Goto GIVE_UP
  535. End
  536. Begin CONTINUE_CC
  537.    Caption 'Sending CC...'
  538.    CreateCC 50 80 Delimiter ';;'
  539.    When 'Also send to?:' Goto SEND_CC
  540.    Timeout 20 Goto GIVE_UP
  541. End
  542. Begin SEND_REAL_NAME
  543.    Transmit $YOURNAME
  544.    Cr
  545.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  546.    When 'Your name: ' Goto SEND_REAL_NAME
  547.    When 'or N) !' Goto ANSWER2_YES
  548.    Timeout 20 Goto GIVE_UP
  549. End
  550. Begin ANSWER2_YES
  551.    Transmit 'Y'
  552.    Cr
  553.    When 'address correct? (Y or N)! ' Goto CONFIRM_LETTER
  554.    Timeout 20 Goto GIVE_UP
  555. End
  556. Begin CONFIRM_LETTER
  557.    Transmit 'Y'
  558.    Cr
  559.    When 'and address correct? (Y or N)! ' Goto CONFIRM_LETTER
  560.    When 'Message sent to ' Goto LETTER_SEND_CONFIRMED
  561.    Timeout 20 Goto GIVE_UP
  562. End
  563. Begin LETTER_SEND_CONFIRMED
  564.    Confirm LETTER.SENT Successful
  565.    Caption 'Letter Delivered'
  566.    When %presscr% Goto BACK_TO_MAIL_MENU
  567.    Timeout 20 Goto GIVE_UP
  568. End
  569. ;------------------------------------------------------
  570. ; These states deal with recovering from a bad address
  571. ; or CC, then put us back into the main Mail area.
  572. ;
  573. Begin BAD_ADDRESS
  574.     Caption 'Unknown Address'
  575.     Cr
  576.     When 'Subject:' Goto SEND_NULL_SUBJ
  577.     When %cisprompt% Goto LETTER_ABORTED
  578.     Timeout 30 Goto GIVE_UP
  579. End
  580. Begin SEND_NULL_SUBJ
  581.     Cr
  582.     When %presscr% Goto SEND_CR_ABORT
  583.     When %cisprompt% Goto LETTER_ABORTED
  584.     Timeout 20 Goto GIVE_UP
  585. End
  586. Begin SEND_CR_ABORT
  587.     Cr
  588.     When %presscr% Goto SEND_CR_ABORT
  589.     When %cisprompt% Goto LETTER_ABORTED
  590.     Timeout 20 Goto GIVE_UP
  591. End
  592. Begin LETTER_ABORTED
  593.     Caption 'Letter NOT Delivered'
  594.     Cr
  595.     Confirm LETTER.SENT Unsuccessful
  596.     When 'CompuServe Mail  Main Menu' Goto MAIL_MAIN_MENU
  597.     When %presscr% Goto BACK_TO_MAIL_MENU
  598.     When %cisprompt% Goto JUMP_TO_MAIL
  599.     Timeout 20 Goto JUMP_TO_MAIL
  600. End
  601. ;------------------------------------------------------
  602. ; This is where we check to see if we have more letters
  603. ; to send before we log off.  If so, we jump back to the
  604. ; main Mail Menu.
  605. ;
  606. Begin BACK_TO_MAIL_MENU
  607.    Cr
  608.    If MORE_LETTERS Then PREPARE_TO_SEND_MORE
  609.    When 'CompuServe Mail  Main Menu' Goto WAIT_TO_LOG_OFF
  610.    When %presscr% Goto BACK_TO_MAIL_MENU
  611.    When %cisprompt% Goto LOG_OFF
  612.    Timeout 20 Goto GIVE_UP
  613. End
  614. Begin PREPARE_TO_SEND_MORE
  615.    When 'CompuServe Mail  Main Menu' Goto MAIL_MAIN_MENU
  616.    When %presscr% Goto BACK_TO_MAIL_MENU
  617.    When %cisprompt% Goto JUMP_TO_MAIL
  618.    Timeout 20 Goto JUMP_TO_MAIL
  619. End
  620. ;------------------------------------------------------
  621. ; These states will be run if we get a "mail system down"
  622. ; response when the script attempts to go into the
  623. ; Mail area.
  624. ;
  625. Begin MAIL_UNAVAILABLE
  626.    Caption 'Mail System Down'
  627.    When %presscr% Goto MAIL_UNAVAILABLE_CR
  628.    Timeout 20 Goto GIVE_UP
  629. End
  630. Begin MAIL_UNAVAILABLE_CR
  631.    Cr
  632.    When %cisprompt% Goto LOG_OFF
  633.    Timeout 20 Goto GIVE_UP
  634. End
  635. ;------------------------------------------------------
  636. ; These states deal with logging off the system
  637. ;
  638. Begin WAIT_TO_LOG_OFF
  639.    When %cisprompt% Goto LOG_OFF
  640.    Timeout 20 Goto GIVE_UP
  641. End
  642. Begin LOG_OFF
  643.    Transmit 'off'
  644.    Cr
  645.    Caption 'Logging off'
  646.    When 'NO CAR' Goto EXIT_PROGRAM
  647.    When 'Disconnected' Goto HANGUP
  648.    When 'DISCONNECTED' Goto HANGUP
  649.    When %tymlogin% Goto HANGUP
  650.    When 'Do you wish to exit CompuServe Mail anyway?' Goto CONFIRM_LOGOFF
  651.    When %cisprompt% Goto LOG_OFF
  652.    CarrierLoss Goto EXIT_PROGRAM
  653.    Timeout 20 Goto SPRINT_BYE
  654. End
  655. Begin CONFIRM_LOGOFF
  656.    Transmit 'Y'
  657.    Cr
  658.    When 'NO CAR' Goto EXIT_PROGRAM
  659.    When 'Disconnected' Goto HANGUP
  660.    When 'DISCONNECTED' Goto HANGUP
  661.    When %tymlogin% Goto HANGUP
  662.    When 'Do you wish to exit CompuServe Mail anyway?' Goto CONFIRM_LOGOFF
  663.    When %cisprompt% Goto LOG_OFF
  664.    CarrierLoss Goto EXIT_PROGRAM
  665.    Timeout 20 Goto SPRINT_BYE
  666. End
  667. Begin SPRINT_BYE
  668.    Cr
  669.    Transmit '@'
  670.    Cr
  671.    When '@' Goto SPRINT_DISC
  672.    CarrierLoss Goto EXIT_PROGRAM
  673.    Timeout 10 Goto HANGUP
  674. End
  675. Begin SPRINT_DISC
  676.    Transmit 'D'
  677.    Cr
  678.    CarrierLoss Goto EXIT_PROGRAM
  679.    Timeout 5 Goto HANGUP
  680. End
  681. Begin EXIT_PROGRAM
  682.    Caption 'Logged off'
  683.    CarrierLoss Goto EXIT_PROGRAM
  684.    Timeout 3 Goto BYE_BYE
  685. End
  686. Begin HANGUP
  687.    Hangup
  688.    CarrierLoss Goto EXIT_PROGRAM
  689. End
  690. Begin GIVE_UP
  691.    Caption 'Aborting'
  692.    Hangup
  693.    CarrierLoss Goto EXIT_PROGRAM
  694. End
  695. Begin NO_LOGIN
  696.    Caption 'login failed'
  697.    Timeout 5 Goto EXIT_PROGRAM
  698. End
  699. Begin BYE_BYE
  700.    Exit
  701. End
  702.  
  703.