home *** CD-ROM | disk | FTP | other *** search
/ Dream 42 / Amiga_Dream_42.iso / RiscPC / Internet / Connexion / slip.spk / !SLIPdial_Scripts_demon < prev    next >
Encoding:
Text File  |  1994-04-02  |  4.2 KB  |  192 lines

  1. #slipdial
  2. # !SlipDial 0.29 Demon Script - R.W.Orwin 1994 (rob@wong.demon.co.uk)
  3. #                Sprites by James Woodman (woody@bacchus.demon.co.uk)
  4.  
  5. # Yes I know it's untidy and badly written ;-)
  6.  
  7. ######################
  8. # Initialisation Stuff
  9. debug 2
  10. icon /file="SlipDial:DemonSpr"
  11. set hg ""
  12. call configure
  13.  
  14. ###################################
  15. # Set Serial Port/Driver Parameters
  16.  
  17. driver USR
  18. port %wport %prtnum
  19. speed %speed
  20. set protocol slip
  21.  
  22. # change following line to "call hgon" for default of mercury use to 'on'
  23. call hgoff
  24.  
  25. #############
  26. # Setup menus
  27. menu "Edinburgh:call edi" "London:call lon" "Reading:call red" "Warrington:call war"
  28. menu /icon="Mercury" "Hg On:call hgon" "Hg Off:call hgoff"
  29.  
  30. ###########
  31. # main loop
  32. :loop
  33. message /close
  34. wait /event
  35. goto loop
  36. exit
  37.  
  38. ###########################
  39. # Set number for London PoP
  40. :lon
  41. set phonenum 0813434848
  42. goto dodial
  43.  
  44. ##############################
  45. # Set number for Edinburgh PoP
  46. :edi
  47. set phonenum 0315528883
  48. goto dodial
  49.  
  50. ###############################
  51. # Set number for Warrington PoP
  52. :war
  53. set phonenum 0925411383
  54. goto dodial
  55.  
  56. ############################
  57. # Set number for Reading PoP
  58. :red
  59. set phonenum 0734328989
  60. goto dodial
  61.  
  62. #######################
  63. # Dial Demon and Log on
  64. :dodial
  65. #convert any outgoing mail/news
  66. if (?file <Rucp$Dir>.uucp.spool.post.c.*) call convmail
  67. if (?file <Rucp$Dir>.uucp.spool.news.c.*) call convmail
  68. set diff 4
  69. set tmstrt 0
  70. set tmend 0
  71. task /kill="Incorp"
  72. if (!claim 3) return 0
  73. init ATZ
  74. retry 5 15
  75. if (!dial %hg%phonenum) goto dodial
  76. #get username/password prompts to authenticate self to server. If fail, restart
  77.  
  78. if (!wait /del=20 ogin:) goto dodial
  79. send %nodename
  80.  
  81. if (!wait /del=20 assword:) goto dodial
  82. set tmstrt %$time
  83. send %password
  84.  
  85. if (!wait /del=50 rotocol:) goto dodial
  86. send %protocol
  87.  
  88. set tmend %$time
  89. set diff {eval "%tmend-%tmstrt"}
  90. set diff {eval "%diff DIV 2"}
  91. if (?eq %diff 0) set diff 1
  92.  
  93. message /capture="IP" /end="HELLO" /maxlines=5 /centre
  94. ipget 158.
  95. if (!wait /del=30 HELLO) goto dodial
  96. wait /delay=%diff "a while"
  97. task <TCPIP$dir>.!Run
  98. :loop2
  99. alarm /dcd "goto terminate"
  100. wait /event
  101. goto loop2
  102.  
  103. ###############################################
  104. # Call has been terminated, so release the port
  105. :terminate
  106. task /kill="TCP/IP"
  107. message /close
  108. message "Call Terminated" /centre
  109. release
  110.  
  111. # now pause for 1 second to allow RISC OS to sort out the display.
  112. pause 1
  113.  
  114. # Following small section is for users of !ReadNews & !Rucp & RN Filters
  115. # <Internet$Dir> should be set to directory where all of above can be found.
  116. task "<Internet$Dir>.ka9q->rucp { > null: }"
  117. task "<Internet$Dir>.!Incorp.!Run"
  118.  
  119. #now trim DemHist File
  120. call trimfile <NNTP$Dir>.DemHist
  121.  
  122. return 1
  123.  
  124. #################################
  125. # Run rucp-ka9q filter and return
  126. :convmail
  127. task "<Internet$Dir>.rucp->ka9q { > null: }"
  128. return 1
  129.  
  130. ##########################
  131. # set Mercury switch to On
  132. :hgon
  133. icon /id="Mercury" /action="call mercury" hgon
  134. set hg %mercury
  135. return 1
  136.  
  137. ###########################
  138. # Set Mercury switch to off
  139. :hgoff
  140. icon /id="Mercury" /action="call mercury" hgoff
  141. set hg ""
  142. return 1
  143.  
  144. ###########################
  145. # Toggle setting of mercury
  146. :mercury
  147. if (?eq %hg %mercury) goto hgoff
  148. goto hgon
  149.  
  150. ###############################
  151. # Trim a specified history file
  152. :trimfile
  153. if (?lt {?file/size %p1} 5000) return
  154. copy/tail=200 %p1 %p1-T;delete %p1;move %p1-T %p1
  155. return 
  156.  
  157. #
  158. # This loads password config from file or prompts for data to create file.
  159. #
  160. :configure
  161. set filename {?file/expand slipdial:demonconfg}
  162. if (!?file %filename) call setup1
  163. open/read/id=conf/error="return" %filename
  164. read/id=conf/eof="goto closeconf" wport
  165. read/id=conf/eof="goto closeconf" prtnum
  166. read/id=conf/eof="goto closeconf" speed
  167. read/id=conf/eof="goto closeconf" nodename
  168. read/id=conf/eof="goto closeconf" password
  169. read/id=conf/eof="goto closeconf" mercury
  170. :closeconf
  171. close/id=conf
  172. return
  173.  
  174. :setup1
  175. input/prompt="Enter Serial Block Driver Name" wport
  176. input/prompt="Enter Serial Port Number (if relevant)" prtnum
  177. input/prompt="Enter Your Modem->Computer Speed (bps):" speed
  178. input/prompt="Enter Your Demon Nodename:" nodename
  179. input/prompt="Enter Your Password:" password
  180. input/prompt="Enter Your Mercury PIN:" mercury
  181. open/id=conf/write %filename
  182. write/id=conf %wport
  183. write/id=conf %prtnum
  184. write/id=conf %speed
  185. write/id=conf %nodename
  186. write/id=conf %password
  187. write/id=conf %mercury
  188. close/id=conf
  189. return
  190.  
  191.  
  192.