home *** CD-ROM | disk | FTP | other *** search
- SYS_ECHO$ = 0
- SYS_INCOMING_CRLF$ = 0
- SYS_OUTGOING_CRLF$ = 0
-
- capture "C:\Documents\Connect.log"
-
- ReplyFile$ = "C:\Documents\Reply.txt"
-
- // Set variables depending on options
-
- if ULProtocol$ = "x" or ULProtocol$ = "c" then
- ULProtocolFull$ = "XModem"
- ULWait$ = "Xmodem upload"
- elseif ULProtocol$ = "y" then
- ULProtocolFull$ = "YModem (batch)"
- ULWait$ = "Ymodem upload"
- elseif ULProtocol$ = "yb" then
- ULProtocol$ = "y"
- ULProtocolFull$ = "YModem (batch) Beta"
- ULWait$ = "Ymodem upload"
- endif
-
- if DLProtocol$ = "x" then
- DLProtocolFull$ = "XModem"
- DLWait$ = "Filesize"
- elseif DLProtocol$ = "y" then
- DLProtocolFull$ = "YModem (batch)"
- DLWait$ = "Sending in Batch Mode"
- elseif DLProtocol$ = "yb" then
- DLProtocol$ = "y"
- DLProtocolFull$ = "YModem (batch) Beta"
- DLWait$ = "Sending in Batch Mode"
- endif
-
- // Check and Initialise modem
- sendwait 20 InitModem$ & "<$d>", "OK" goto mError
- sendwait 20 Volume$ & "<$d>", "OK" goto mError
-
- // Dial Cix
- reDial:
- send "ATDT" & CixNumber$ & "<$d>"
-
- // Wait for a reply
- wait 120
- "CONNECT" goto letsGo
- "NO DIALTONE" goto noDialtone
- "NO CARRIER" goto noCarrier
- "ERROR" goto blacklisted
- "BUSY" goto busy
- "OK" goto cancelled
- endwait
- status "Unrecognised reply from modem"
- wait 10
- endwait
- goto allDone
-
- // Modem not replying 'OK' after AT commands
- mError:
- status "Modem not responding - check it is connected"
- wait 10
- endwait
- goto allDone
-
- noDialtone:
- status "No dialtone - check connection to telephone line"
- wait 10
- endwait
- goto allDone
-
- noCarrier:
- status "No connection made"
- wait 10
- endwait
- goto allDone
-
- blacklisted:
- status "Number dialled too many times"
- wait 10
- endwait
- goto allDone
-
- // User aborted by pressing a key during dialling
- cancelled:
- status "User aborted!"
- wait 10
- endwait
- goto allDone
-
- busy:
- status "Number engaged"
- wait 10
- endwait
- goto allDone
-
- noLogin:
- status "No Username: prompt received"
- wait 10
- endwait
- goto allDone
-
- noUser:
- status "No User: prompt received"
- wait 10
- endwait
- goto allDone
-
- noPassword:
- status "No Password prompt received"
- wait 10
- endwait
- goto allDone
-
- gotMore:
- send "n"
- goto tryAgain
-
- // At this point the modem has issued a Connect message
- letsGo:
- status "Connected"
- sendwait 180 "<$d>";, "Username:" goto noLogin
- sendwait 80 "qix" & "<$d>";, "new user" goto noUser
- sendwait 40 CixUserName$ & "<$d>";, "Password:" goto noPassword
- send CixPassword$ & "<$d>"
-
- tryAgain:
- // Wait for 'M:' or 'More' prompts
- wait 80
- "M:" goto gotM
- "Main:" goto gotMain
- "More?" goto gotMore
- endwait
- status "No Main:, M:, or More? prompt received"
- goto allDone
-
- gotM:
- if Format$ = "verbose" then
- send Format$ & "<$d>"
- goto tryagain
- endif
- Prompt$ = "M:"
- MailPrompt$ = "Ml:"
- ReadPrompt$ = "R:"
- goto gotPrompt
-
- gotMain:
- if Format$ = "terse" then
- send Format$ & "<$d>"
- goto tryagain
- endif
- Prompt$ = "Main:"
- MailPrompt$ = "Mail:"
- ReadPrompt$ = "Read:"
-
- // By now w'are online and have a Main: or M: prompt
- gotPrompt:
- if Option$ = "term" then
- info "You are now 'on-line' on CIX. Type 'bye' to log-off.<$d><$a>"
- exit
- endif
-
- // Turn page "More?"ing off, withdrawn messages on,
- // multi-pass scratchpad building off, max message size...
- sendwait 20 "opt term page 0, ref n, missing y, file single y, q<$d>", Prompt$ goto noPrompt
- sendwait 20 "opt scratchname Scratchpad, messagesize 65535, q<$d>", Prompt$ goto noPrompt
-
- // Set compactheaders on or off as appropriate
- if Compact$ <> "" then
- sendwait 20 "opt compactheader " & Compact$ & " q<$d>", Prompt$ goto noPrompt
- endif
-
- // Store message pointers. If there's a problem, you can
- // 'restore' to undo everything since.
- if Pointer$ = "none" then
- sendwait 10 "store<$d>", Prompt$ goto noPrompt
- elseif Pointer$ = "restore" then
- sendwait 10 "restore<$d>", Prompt$ goto noPrompt
- else
- sendwait 30 "order first cixnews<$d>", Prompt$ goto noPrompt
- sendwait 30 "macro fred hea skip to back " & Pointer$ & " tnext fred<$d>", Prompt$ goto noPrompt
- sendwait 30 "j cixnews/information<$d>", ReadPrompt$ goto noPrompt
- sendwait 400 "file fred<$d>", Prompt$ goto noPrompt
- sendwait 30 "killscratch<$d>", Prompt$ goto noPrompt
- endif
-
- if Option$ = "reco" then
- goto doDownload
- endif
-
- // Upload
- if exists ReplyFile$ = 1 then
- sendwait 20 "opt u " & ULProtocol$ & " q<$d>", Prompt$ goto noPrompt
- sendwait 20 "upl<$d>", ULWait$ goto noUpStart
- upload ReplyFile$, ULProtocolFull$
-
- // Delay to allow Cix to catch up with 5mx
- dummy:
- wait 10
- "Upload succeeded" goto putScript
- "Scratchpad" goto putScript
- Prompt$ goto putScript
- endwait
- goto uploadFailed
-
- putScript:
- sendwait 400 "scput script<$d>", Prompt$ goto noPrompt
- sendwait 600 "script<$d>", Prompt$ goto noPrompt
- // ** Tidy up by archiving the reply file
- copy ReplyFile$, "C:\Documents\OldReply.old"
- delete ReplyFile$
- endif
-
- if Option$ <> "conf" then
- sendwait 120 "mail file all<$d>", MailPrompt$ goto noMail
- sendwait 60 "q<$d>", Prompt$ goto noPrompt
- endif
-
- if Option$ <> "mail" then
- sendwait 600 "file read all<$d>", Prompt$ goto noPrompt
- endif
-
- doDownload:
- // Download
- sendwait 40 "opt d " & DLProtocol$ & " q<$d>", Prompt$ goto noPrompt
- sendwait 80 "down<$d>", DLWait$ goto noDownStart
- download "C:\Documents\Scratchpad", DLProtocolFull$
-
- // Check that the d/l succeeded.
- erase$ = "n"
- wait 5
- "Download succeeded" goto doDelete
- endwait
- // Download failed, so leave scratchpad undeleted on Cix
- goto downloadFailed
-
- // ** Delete scratchpad and disconnect from CIX
- doDelete:
- erase$="y"
- wait 3
- "OK to delete" goto putDelete
- endwait
-
- putDelete:
- sendwait 40 erase$ & "<$d>", Prompt$ goto noPrompt
-
- if erase$ = "y" then
- // #INSERT# Leave this comment in for inserting script
- endif
-
- cont:
- sendwait 8 "bye<$d>", "HANGUP NOW" goto noHangup
- wait 1
- endwait
- send "+++"
- wait 1
- endwait
- hangup
- wait 2
- endwait
- if erase$ = "n" then
- status "Download error. Use Recover scratchpad on tools menu"
- wait 20
- endwait
- endif
- info "-------------------------------------------------------<$d><$a>"
- info "Blink completed. Please use Control-E to Close Comms<$d><$a>"
- info "and then switch back to CixEd using the task-list or the Extras bar.<$d><$a>"
- goto allDone
-
- downloadFailed:
- hangup
- status "Download failed or timed out. Use Recover to download scratchpad"
- wait 20
- endwait
- goto allDone
-
- uploadFailed:
- hangup
- status "Upload failed or timed out. Exiting session"
- wait 20
- endwait
- goto allDone
-
- noPrompt:
- status "No " & Prompt$ & " prompt received"
- wait 10
- endwait
- goto allDone
-
- noMail:
- status "No " & MailPrompt$ & " prompt received"
- wait 10
- endwait
- goto allDone
-
- noUpStart:
- status "No Start upload received"
- wait 10
- endwait
- goto allDone
-
- noDownStart:
- status "No Start download received"
- wait 10
- endwait
- goto allDone
-
- noHangup:
- // Might have got here by there being mail waiting, so CIX
- // will have sent "There is unread Mail, do you really want to
- // quit? (y/n)?"
- sendwait 20 "y<$d>", "have been" goto noHaveBeen
- hangup
- wait 2
- endwait
- info "-------------------------------------------------------<$d><$a>"
- info "Blink completed. Please use Control-E to close Comms<$d><$a>"
- info "and then switch back to CixEd using the task-list or the Extras bar.<$d><$a>"
- goto allDone
-
- noHaveBeen:
- status "No blink summary message received from Cix"
- wait 10
- endwait
- goto allDone
-
- allDone:
- if exists "c:\documents\cixed.scr" = 1 then
- delete "c:\documents\cixed.scr"
- endif
- exit