home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 722 / CixEd.sis / 008.CixEd.scr < prev    next >
Encoding:
Text File  |  2000-01-02  |  7.6 KB  |  330 lines

  1.     SYS_ECHO$ = 0
  2.     SYS_INCOMING_CRLF$ = 0
  3.     SYS_OUTGOING_CRLF$ = 0
  4.  
  5.     capture "C:\Documents\Connect.log"
  6.  
  7.     ReplyFile$ = "C:\Documents\Reply.txt"
  8.  
  9.     // Set variables depending on options
  10.  
  11.     if ULProtocol$ = "x" or ULProtocol$ = "c" then
  12.         ULProtocolFull$ = "XModem"
  13.         ULWait$ = "Xmodem upload"
  14.     elseif ULProtocol$ = "y" then
  15.         ULProtocolFull$ = "YModem (batch)"
  16.         ULWait$ = "Ymodem upload"
  17.     elseif ULProtocol$ = "yb" then
  18.         ULProtocol$ = "y"
  19.         ULProtocolFull$ = "YModem (batch) Beta"
  20.         ULWait$ = "Ymodem upload"
  21.     endif
  22.  
  23.     if DLProtocol$ = "x" then
  24.         DLProtocolFull$ = "XModem"
  25.         DLWait$ = "Filesize"
  26.     elseif DLProtocol$ = "y" then
  27.         DLProtocolFull$ = "YModem (batch)"
  28.         DLWait$ = "Sending in Batch Mode"
  29.     elseif DLProtocol$ = "yb" then
  30.         DLProtocol$ = "y"
  31.         DLProtocolFull$ = "YModem (batch) Beta"
  32.         DLWait$ = "Sending in Batch Mode"
  33.     endif
  34.  
  35.     // Check and Initialise modem
  36.     sendwait 20 InitModem$ & "<$d>", "OK" goto mError
  37.     sendwait 20 Volume$ & "<$d>", "OK" goto mError
  38.  
  39.     // Dial Cix
  40.     reDial:
  41.     send "ATDT" & CixNumber$ & "<$d>"
  42.  
  43.     // Wait for a reply
  44.     wait 120
  45.         "CONNECT" goto letsGo
  46.         "NO DIALTONE" goto noDialtone
  47.         "NO CARRIER" goto noCarrier
  48.         "ERROR" goto blacklisted
  49.         "BUSY" goto busy
  50.         "OK" goto cancelled
  51.     endwait
  52.     status "Unrecognised reply from modem"
  53.     wait 10
  54.     endwait
  55.     goto allDone
  56.  
  57. // Modem not replying 'OK' after AT commands
  58. mError:
  59.     status "Modem not responding - check it is connected"
  60.     wait 10
  61.     endwait
  62.     goto allDone
  63.  
  64. noDialtone:
  65.     status "No dialtone - check connection to telephone line"
  66.     wait 10
  67.     endwait
  68.     goto allDone
  69.  
  70. noCarrier:
  71.     status "No connection made"
  72.     wait 10
  73.     endwait
  74.     goto allDone
  75.  
  76. blacklisted:
  77.     status "Number dialled too many times"
  78.     wait 10
  79.     endwait
  80.     goto allDone
  81.  
  82. // User aborted by pressing a key during dialling
  83. cancelled:
  84.     status "User aborted!"
  85.     wait 10
  86.     endwait
  87.     goto allDone
  88.  
  89. busy:
  90.     status "Number engaged"
  91.     wait 10
  92.     endwait
  93.     goto allDone
  94.  
  95. noLogin:
  96.     status "No Username: prompt received"
  97.     wait 10
  98.     endwait
  99.     goto allDone
  100.  
  101. noUser:
  102.     status "No User: prompt received"
  103.     wait 10
  104.     endwait
  105.     goto allDone
  106.  
  107. noPassword:
  108.     status "No Password prompt received"
  109.     wait 10
  110.     endwait
  111.     goto allDone
  112.  
  113. gotMore:
  114.     send "n"
  115.     goto tryAgain
  116.  
  117. // At this point the modem has issued a Connect message
  118. letsGo:
  119.     status "Connected"
  120.     sendwait 180 "<$d>";, "Username:" goto noLogin
  121.     sendwait 80 "qix" & "<$d>";, "new user" goto noUser
  122.     sendwait 40 CixUserName$ & "<$d>";, "Password:" goto noPassword
  123.     send CixPassword$ & "<$d>"
  124.  
  125. tryAgain:
  126.     // Wait for 'M:' or 'More' prompts
  127.     wait 80
  128.         "M:" goto gotM
  129.         "Main:" goto gotMain
  130.         "More?" goto gotMore
  131.     endwait
  132.     status "No Main:, M:, or More? prompt received"
  133.     goto allDone
  134.  
  135. gotM:
  136.     if Format$ = "verbose" then
  137.         send Format$ & "<$d>"
  138.         goto tryagain
  139.     endif
  140.     Prompt$ = "M:"
  141.     MailPrompt$ = "Ml:"
  142.     ReadPrompt$ = "R:"
  143.     goto gotPrompt
  144.  
  145. gotMain:
  146.     if Format$ = "terse" then
  147.         send Format$ & "<$d>"
  148.         goto tryagain
  149.     endif
  150.     Prompt$ = "Main:"
  151.     MailPrompt$ = "Mail:"
  152.     ReadPrompt$ = "Read:"
  153.  
  154.     // By now w'are online and have a Main: or M: prompt
  155. gotPrompt:
  156.     if Option$ = "term" then
  157.         info "You are now 'on-line' on CIX.  Type 'bye' to log-off.<$d><$a>"
  158.         exit
  159.     endif
  160.  
  161.     // Turn page "More?"ing off, withdrawn messages on,
  162.     // multi-pass scratchpad building off, max message size...
  163.     sendwait 20 "opt term page 0, ref n, missing y, file single y, q<$d>", Prompt$ goto noPrompt
  164.     sendwait 20 "opt scratchname Scratchpad, messagesize 65535, q<$d>", Prompt$ goto noPrompt
  165.  
  166.     // Set compactheaders on or off as appropriate
  167.     if Compact$ <> "" then
  168.         sendwait 20 "opt compactheader " & Compact$ & " q<$d>", Prompt$ goto noPrompt
  169.     endif
  170.  
  171.     // Store message pointers.  If there's a problem, you can
  172.     // 'restore' to undo everything since.
  173.     if Pointer$ = "none" then
  174.         sendwait 10 "store<$d>", Prompt$ goto noPrompt
  175.     elseif Pointer$ = "restore" then
  176.         sendwait 10 "restore<$d>", Prompt$ goto noPrompt
  177.     else
  178.         sendwait 30 "order first cixnews<$d>", Prompt$ goto noPrompt
  179.         sendwait 30 "macro fred hea skip to back " & Pointer$ & " tnext fred<$d>", Prompt$ goto noPrompt
  180.         sendwait 30 "j cixnews/information<$d>", ReadPrompt$ goto noPrompt
  181.         sendwait 400 "file fred<$d>", Prompt$ goto noPrompt
  182.         sendwait 30 "killscratch<$d>", Prompt$ goto noPrompt
  183.     endif
  184.  
  185.     if Option$ = "reco" then
  186.         goto doDownload
  187.     endif
  188.  
  189.     // Upload
  190.     if exists ReplyFile$ = 1 then
  191.         sendwait 20 "opt u " & ULProtocol$ & " q<$d>", Prompt$ goto noPrompt
  192.         sendwait 20 "upl<$d>", ULWait$ goto noUpStart
  193.         upload ReplyFile$, ULProtocolFull$
  194.  
  195.         // Delay to allow Cix to catch up with 5mx
  196. dummy:
  197.         wait 10
  198.             "Upload succeeded" goto putScript
  199.             "Scratchpad" goto putScript
  200.             Prompt$ goto putScript
  201.             endwait
  202.         goto uploadFailed
  203.  
  204. putScript:
  205.         sendwait 400 "scput script<$d>", Prompt$ goto noPrompt
  206.         sendwait 600 "script<$d>", Prompt$ goto noPrompt
  207.         // ** Tidy up by archiving the reply file
  208.         copy ReplyFile$, "C:\Documents\OldReply.old"
  209.         delete ReplyFile$
  210.     endif
  211.  
  212.     if Option$ <> "conf" then
  213.         sendwait 120 "mail file all<$d>", MailPrompt$ goto noMail
  214.         sendwait 60 "q<$d>", Prompt$ goto noPrompt
  215.     endif
  216.  
  217.     if Option$ <> "mail" then
  218.         sendwait 600 "file read all<$d>", Prompt$ goto noPrompt
  219.     endif
  220.  
  221. doDownload:
  222.     // Download
  223.     sendwait 40 "opt d " & DLProtocol$ & " q<$d>", Prompt$ goto noPrompt
  224.     sendwait 80 "down<$d>", DLWait$ goto noDownStart
  225.     download "C:\Documents\Scratchpad", DLProtocolFull$
  226.  
  227.     // Check that the d/l succeeded.
  228.     erase$ = "n"
  229.     wait 5
  230.         "Download succeeded" goto doDelete
  231.     endwait
  232.     // Download failed, so leave scratchpad undeleted on Cix
  233.     goto downloadFailed
  234.  
  235.     // ** Delete scratchpad and disconnect from CIX
  236. doDelete:
  237.     erase$="y"
  238.     wait 3
  239.         "OK to delete" goto putDelete
  240.     endwait
  241.  
  242. putDelete:
  243.     sendwait 40 erase$ & "<$d>", Prompt$ goto noPrompt
  244.  
  245.     if erase$ = "y" then
  246.         // #INSERT# Leave this comment in for inserting script
  247.     endif
  248.  
  249. cont:
  250.     sendwait 8 "bye<$d>", "HANGUP NOW" goto noHangup
  251.     wait 1
  252.     endwait
  253.     send "+++"
  254.     wait 1
  255.     endwait
  256.     hangup
  257.     wait 2
  258.     endwait
  259.     if erase$ = "n" then
  260.         status "Download error. Use Recover scratchpad on tools menu"
  261.         wait 20
  262.         endwait
  263.     endif
  264.     info "-------------------------------------------------------<$d><$a>"
  265.     info "Blink completed. Please use Control-E to Close Comms<$d><$a>"
  266.     info "and then switch back to CixEd using the task-list or the Extras bar.<$d><$a>"
  267.     goto allDone
  268.  
  269. downloadFailed:
  270.     hangup
  271.     status "Download failed or timed out. Use Recover to download scratchpad"
  272.     wait 20
  273.     endwait
  274.     goto allDone
  275.  
  276. uploadFailed:
  277.     hangup
  278.     status "Upload failed or timed out. Exiting session"
  279.     wait 20
  280.     endwait
  281.     goto allDone
  282.  
  283. noPrompt:
  284.     status "No " & Prompt$ & " prompt received"
  285.     wait 10
  286.     endwait
  287.     goto allDone
  288.  
  289. noMail:
  290.     status "No " & MailPrompt$ & " prompt received"
  291.     wait 10
  292.     endwait
  293.     goto allDone
  294.  
  295. noUpStart:
  296.     status "No Start upload received"
  297.     wait 10
  298.     endwait
  299.     goto allDone
  300.  
  301. noDownStart:
  302.     status "No Start download received"
  303.     wait 10
  304.     endwait
  305.     goto allDone
  306.  
  307. noHangup:
  308.     // Might have got here by there being mail waiting, so CIX
  309.     // will have sent "There is unread Mail, do you really want to
  310.     // quit? (y/n)?"
  311.     sendwait 20 "y<$d>", "have been" goto noHaveBeen
  312.     hangup
  313.     wait 2
  314.     endwait
  315.     info "-------------------------------------------------------<$d><$a>"
  316.     info "Blink completed. Please use Control-E to close Comms<$d><$a>"
  317.     info "and then switch back to CixEd using the task-list or the Extras bar.<$d><$a>"
  318.     goto allDone
  319.  
  320. noHaveBeen:
  321.     status "No blink summary message received from Cix"
  322.     wait 10
  323.     endwait
  324.     goto allDone
  325.  
  326. allDone:
  327.     if exists "c:\documents\cixed.scr" = 1 then
  328.         delete "c:\documents\cixed.scr"
  329.     endif
  330.     exit