home *** CD-ROM | disk | FTP | other *** search
- #slipdial
- # !SlipDial 0.29 Demon Script - R.W.Orwin 1994 (rob@wong.demon.co.uk)
- # Sprites by James Woodman (woody@bacchus.demon.co.uk)
-
- # Yes I know it's untidy and badly written ;-)
-
- ######################
- # Initialisation Stuff
- debug 2
- icon /file="SlipDial:DemonSpr"
- set hg ""
- call configure
-
- ###################################
- # Set Serial Port/Driver Parameters
-
- driver USR
- port %wport %prtnum
- speed %speed
- set protocol slip
-
- # change following line to "call hgon" for default of mercury use to 'on'
- call hgoff
-
- #############
- # Setup menus
- menu "Edinburgh:call edi" "London:call lon" "Reading:call red" "Warrington:call war"
- menu /icon="Mercury" "Hg On:call hgon" "Hg Off:call hgoff"
-
- ###########
- # main loop
- :loop
- message /close
- wait /event
- goto loop
- exit
-
- ###########################
- # Set number for London PoP
- :lon
- set phonenum 0813434848
- goto dodial
-
- ##############################
- # Set number for Edinburgh PoP
- :edi
- set phonenum 0315528883
- goto dodial
-
- ###############################
- # Set number for Warrington PoP
- :war
- set phonenum 0925411383
- goto dodial
-
- ############################
- # Set number for Reading PoP
- :red
- set phonenum 0734328989
- goto dodial
-
- #######################
- # Dial Demon and Log on
- :dodial
- #convert any outgoing mail/news
- if (?file <Rucp$Dir>.uucp.spool.post.c.*) call convmail
- if (?file <Rucp$Dir>.uucp.spool.news.c.*) call convmail
- set diff 4
- set tmstrt 0
- set tmend 0
- task /kill="Incorp"
- if (!claim 3) return 0
- init ATZ
- retry 5 15
- if (!dial %hg%phonenum) goto dodial
- #get username/password prompts to authenticate self to server. If fail, restart
-
- if (!wait /del=20 ogin:) goto dodial
- send %nodename
-
- if (!wait /del=20 assword:) goto dodial
- set tmstrt %$time
- send %password
-
- if (!wait /del=50 rotocol:) goto dodial
- send %protocol
-
- set tmend %$time
- set diff {eval "%tmend-%tmstrt"}
- set diff {eval "%diff DIV 2"}
- if (?eq %diff 0) set diff 1
-
- message /capture="IP" /end="HELLO" /maxlines=5 /centre
- ipget 158.
- if (!wait /del=30 HELLO) goto dodial
- wait /delay=%diff "a while"
- task <TCPIP$dir>.!Run
- :loop2
- alarm /dcd "goto terminate"
- wait /event
- goto loop2
-
- ###############################################
- # Call has been terminated, so release the port
- :terminate
- task /kill="TCP/IP"
- message /close
- message "Call Terminated" /centre
- release
-
- # now pause for 1 second to allow RISC OS to sort out the display.
- pause 1
-
- # Following small section is for users of !ReadNews & !Rucp & RN Filters
- # <Internet$Dir> should be set to directory where all of above can be found.
- task "<Internet$Dir>.ka9q->rucp { > null: }"
- task "<Internet$Dir>.!Incorp.!Run"
-
- #now trim DemHist File
- call trimfile <NNTP$Dir>.DemHist
-
- return 1
-
- #################################
- # Run rucp-ka9q filter and return
- :convmail
- task "<Internet$Dir>.rucp->ka9q { > null: }"
- return 1
-
- ##########################
- # set Mercury switch to On
- :hgon
- icon /id="Mercury" /action="call mercury" hgon
- set hg %mercury
- return 1
-
- ###########################
- # Set Mercury switch to off
- :hgoff
- icon /id="Mercury" /action="call mercury" hgoff
- set hg ""
- return 1
-
- ###########################
- # Toggle setting of mercury
- :mercury
- if (?eq %hg %mercury) goto hgoff
- goto hgon
-
- ###############################
- # Trim a specified history file
- :trimfile
- if (?lt {?file/size %p1} 5000) return
- copy/tail=200 %p1 %p1-T;delete %p1;move %p1-T %p1
- return
-
- #
- # This loads password config from file or prompts for data to create file.
- #
- :configure
- set filename {?file/expand slipdial:demonconfg}
- if (!?file %filename) call setup1
- open/read/id=conf/error="return" %filename
- read/id=conf/eof="goto closeconf" wport
- read/id=conf/eof="goto closeconf" prtnum
- read/id=conf/eof="goto closeconf" speed
- read/id=conf/eof="goto closeconf" nodename
- read/id=conf/eof="goto closeconf" password
- read/id=conf/eof="goto closeconf" mercury
- :closeconf
- close/id=conf
- return
-
- :setup1
- input/prompt="Enter Serial Block Driver Name" wport
- input/prompt="Enter Serial Port Number (if relevant)" prtnum
- input/prompt="Enter Your Modem->Computer Speed (bps):" speed
- input/prompt="Enter Your Demon Nodename:" nodename
- input/prompt="Enter Your Password:" password
- input/prompt="Enter Your Mercury PIN:" mercury
- open/id=conf/write %filename
- write/id=conf %wport
- write/id=conf %prtnum
- write/id=conf %speed
- write/id=conf %nodename
- write/id=conf %password
- write/id=conf %mercury
- close/id=conf
- return
-
-
-