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