home *** CD-ROM | disk | FTP | other *** search
- ; An ArcTerm7 script to call CIX and download new mail and messages.
- ; written by Paul Vigay - (C)1993
- ; This version dated 3rd May 1995
- ;
- ; This dials the CIX in London at 19200/19200 (v32bis) and downloads
- ; all new messages to any conferences you are a member of. It then
- ; downloads any private mail you may have.
- ; The two files are renamed as CIXmessages and CIXmail respectively.
- ; Lastly, if you have a reply file called MailToCIX, it will upload it for
- ; you.
- ; It can also go into Newnet and download any new messages there.
-
- main ()
- {
- ; Change the following two lines depending upon which directories you
- ; want the downloaded/uploaded files to go in.
- string downloaddir[80]="SCSI::SCSIDisc4.$.Applicats.Comms.Up/Dnloads"
- string uploaddir[80]="SCSI::SCSIDisc4.$.Applicats.Comms.Up/Dnloads"
-
- string newname[80]=""
- string CSI[2]=$chr(27)+"[",red[5]=CSI+"31m",white[5]=CSI+"37m",cyan[5]=CSI+"36m",yellow[5]=CSI+"33m"
- integer flag,busy,line,loop
- openwindow()
-
- ; The following lines set the speed of your communication. This may need to
- ; be changed, depending upon which modem you have.
- port_txspeed(19200)
- port_rxspeed(19200)
-
- $port_wordformat("8N1")
- set(filter,on)
- modem_errorcontrol("mnp5")
- set(terminal,ansi)
- check_files()
- busy=1
- if (flag==0)
- {
- repeat
- {
- line=2
- prints newline+cyan+"Calling CIX - Please wait...."+newline+white
- line=modem_dial("0181 390 1255",1)
-
- ; Wait a second for it to wake up!
- pause(100)
-
- if (line<>2)
- {
-
- ; Wait up to 30 seconds for login prompt
- if (waitfor("login:",3000))
- {
- prints newline+red+"Call failed (no login prompt)"+newline+white
- modem_disconnect()
- return
- }
- type "qix"+cr
- ; Wait 60 secs for username prompt
- if (waitfor("new user)",6000))
- {
- prints newline+red+"Call failed (no username prompt)"+newline+white
- modem_disconnect()
- return
- }
- ; insert your user 'nickname' in the line below!
- type "nickname"+cr
- ; Wait up to 20 seconds for password prompt
- if (waitfor("Password:",2000))
- {
- prints newline+red+"Call failed (no password prompt)"+newline+white
- modem_disconnect()
- return
- }
- ; insert your user 'password' in the line below! (check case)
- type "PASSWORD"+cr
- ; ok respond to any 'More ?' messages.
- whenever(1,"More ?",anykey)
- ; ok, hang up immediately the Goodbye message is displayed.
- whenever(1,"!HANGUP NOW!!!",hangup)
- waitfor("Main")
- ; ******** Now grab any new conference messages *******
- grab_messages()
- ; ******** Now grab any new personal mail messages *******
- grab_mail()
- ; now upload any mail we may have
- send_mail()
- ; now upload any private mail we may have
- send_pmail()
- ; Now whiz to UseNet and grab any new messages.
- grab_newsnet()
- send_newsnet()
- prints newline+red+"OK. Script ended. It's up to you now!!!"+newline+white
- busy=0
- ;type "bye"+cr
- ;waitfor("!!!HANGUP NOW!!!")
- ;modem_disconnect()
- whenever(1,"",off)
- }
- if (busy==1)
- {
- loop=10
- prints newline+yellow+"About to redial. "
- repeat
- {
- print loop
- prints " "
- loop=loop-1
- pause (100)
- }
- until(loop=0)
- }
- }
- until(busy==0)
- }
- }
-
- anykey ()
- {
- type cr
- }
-
- hangup ()
- {
- modem_disconnect()
- }
-
- grab_messages ()
- {
- type "file read all"+cr
- waitfor("Scratchpad")
- if(waitfor("is 69 bytes.",50))
- {
- ;waitfor("Main")
- type "arcscratch"+cr
- waitfor("Main")
- type "download"+cr
- download(zmodem,downloaddir)
- ; Rename downloaded scratchpad so it won't get overwritten,
- ; and set it to an ARC filetype.
- newname=downloaddir+".CIXmsgs"
- oscli("Rename "+downloaddir+".Scratchpad "+newname)
- oscli("SetType "+newname+" ddc")
- waitfor("OK to delete the downloaded scratchpad-file?",500)
- type "Y"+cr
- }
- waitfor("Main")
- }
-
- grab_mail ()
- {
- type "mail"+cr
- waitfor("Mail")
- type "file all"+cr
- waitfor("Scratchpad")
- if(waitfor("is 0 bytes",50))
- {
- ;waitfor("Mail")
- type "arcscratch"+cr
- waitfor("Mail")
- type "download"+cr
- download(zmodem,downloaddir)
- ; Rename downloaded scratchpad so it won't get overwritten,
- ; and set it to an ARC filetype.
- newname=downloaddir+".CMl"
- oscli("Rename "+downloaddir+".Scratchpad "+newname)
- oscli("SetType "+newname+" ddc")
- waitfor("OK to delete the downloaded scratchpad-file?",500)
- type "Y"+cr
- }
- waitfor("Mail")
- type "quit"+cr
- waitfor("Main")
- }
-
- send_mail ()
- {
- string filename[80]=uploaddir+".MailToCIX"
- if (file_openin(0,filename)!=0)
- {
- string line[80]
- integer starttime
- ; File exists: close it and upload
- file_close(0)
- batch_clear()
- batch_add(filename)
- type "upload"+cr
- waitfor("B0100")
- upload(zmodem)
- waitfor("Main:")
- type "scput script"+cr
- waitfor("Main:")
- type "script"+cr
- waitfor("Main:")
- oscli("Copy "+filename+" "+uploaddir+".Old.OldToCIX ~c~vfd")
- }
-
- }
-
- send_pmail ()
- {
- string filename[80]=uploaddir+".MailToCMl"
- if (file_openin(0,filename)!=0)
- {
- string line[80]
- integer starttime
- ; File exists: close it and upload
- file_close(0)
- batch_clear()
- batch_add(filename)
- type "upload"+cr
- waitfor("B0100")
- upload(zmodem)
- waitfor("Main:")
- type "scput script"+cr
- waitfor("Main:")
- type "script"+cr
- waitfor("Main:")
- oscli("Copy "+filename+" "+uploaddir+".Old.OldToCMl ~c~vfd")
- }
-
- }
-
- check_files ()
- {
- ; the following procedure will ensure that the script is only run
- ; if the three files CIXmsgs, CIXmail and Scratchpad do NOT exist.
- flag=0
- if (file_openin(0,downloaddir+".ScratchPa")<>0)
- {
- prints red+"File ScratchPad already exists - Script aborted!"+newline+white
- flag=1
- }
- file_close(0)
- if (file_openin(0,downloaddir+".CIXmsgs")<>0)
- {
- prints red+"File CIXmsgs already exists - Script aborted!"+newline+white
- flag=1
- }
- file_close(0)
- if (file_openin(0,downloaddir+".CIXmail")<>0)
- {
- prints red+"File CIXmail already exists - Script aborted!"+newline+white
- flag=1
- }
- file_close(0)
- }
-
- grab_newsnet ()
- {
- type "go newsnet"+cr
- waitfor("Newsnet:")
- type "batch all endbatch"+cr
- waitfor("Newsnet:")
- type "arcbatch"+cr
- waitfor("Newsnet:")
- type "download messages"+cr
- download(zmodem,downloaddir)
- ;Rename downloaded scratchpad so it won't get overwritten,
- ;and set it to an ARC filetype.
- newname=downloaddir+".UseNet"
- oscli("Rename "+downloaddir+".Scratchpad "+newname)
- oscli("SetType "+newname+" ddc")
- waitfor("Newsnet:")
- }
-
- send_newsnet ()
- {
- string filename[80]=uploaddir+".MailToNews"
- if (file_openin(0,filename)!=0)
- {
- string line[80]
- integer starttime
- ; File exists: close it and upload
- file_close(0)
- batch_clear()
- batch_add(filename)
- type "upload messages"+cr
- waitfor("B0100")
- upload(zmodem)
- waitfor("Newsnet:")
- type "quit"+cr
- waitfor("Main:")
- oscli("Copy "+filename+" "+uploaddir+".Old.OldToNews ~c~vfd")
- }
- }
-