home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2002 July / APC0702D1.iso / isp / tpgi / HelpDesk / scripts / Trumpet / Tpgi.cmd next >
Encoding:
Text File  |  2000-09-24  |  3.8 KB  |  185 lines

  1. #
  2. #  Trumpet Winsock 2.1 Login.cmd
  3. #
  4. #  Copyright (C) 1994,1995 Peter R. Tattam & 
  5. #  Trumpet Software International Pty Ltd (TSI)
  6. #  All rights reserved.
  7. #
  8. #  Unless TSI has given prior written consent to such use, 
  9. #  no permission is granted to distribute or otherwise make available 
  10. #  to the public modified versions of this script for commercial purposes.  
  11. #  Any permitted distribution of modified versions of the script must
  12. #  retain the copyright notice at the start of this file and must clearly 
  13. #  identify those parts of the file which have been modified.
  14. #
  15. # Modified by CK, 27/6/97 - TPG Internet.
  16. #
  17. #trace on
  18. #
  19. # set up some strings for dialling up
  20. #
  21. if ![load $number]
  22.   if [query $number "Enter your dial up phone number"]
  23.     save $number
  24.   end
  25. end
  26. if ![load $username]
  27.   if [username "Enter your login username"]
  28.     save $username
  29.   end
  30. end
  31. if ![load $password]
  32.   if [password "Enter your login password"]
  33.     save $password
  34.   end
  35. end
  36. $modemsetup = "&c1&k3"
  37. $prompt = ">"
  38. $userprompt = "sername:"
  39. $passprompt = "assword:"
  40. $choiceprompt = "hoice:"
  41. $slipcmd = "slip"
  42. $addrtarg = "our address is"
  43. $pppcmd = "ppp"
  44. $pppready = "PPP."
  45. %attempts = 10
  46.  
  47. ###############################################
  48. # timeouts for various sections of the script #
  49. ###############################################
  50. #
  51. # timeout for busy tone... adjust this until the BUSY string is detected.
  52. #
  53. %busytimeout = 10
  54. #
  55. # time between successive busy attempts.
  56. #
  57. %busywait = 30
  58. #
  59. # time to wait for a CONNECT string to be received
  60. #
  61. %connecttimeout = 60
  62. #
  63. # time to wait until DCD is detected
  64. #
  65. %onlinetimeout = 60
  66. #
  67. # time to wait for username & password prompts
  68. #
  69. %logintimeout = 120
  70. #
  71. # time to wait for server prompt to appear
  72. #
  73. %prompttimeout = 120
  74. #
  75. # time to wait for a SLIP address to be parsed
  76. #
  77. %addresstimeout = 120
  78. #
  79. #
  80. #
  81. #
  82. #----------------------------------------------------------
  83. #
  84. # initialize modem
  85. #
  86. status "Initializing modem..."
  87. output "atz"\13
  88. if ! [input 5 OK\n]
  89.   message "Modem is not responding"
  90.   abort
  91. end
  92. #
  93. # setup our modem commands
  94. #
  95. output "at"$modemsetup\13
  96. if ! [input 10 OK\n]
  97.   message "Modem is not responding"
  98.   abort
  99. end
  100. #
  101. # send phone number
  102. #
  103. %n = 0
  104. repeat
  105.   %n = %n + 1
  106.   if %n > %attempts
  107.     message "Too many dial attempts"
  108.     abort
  109.   end
  110.   status Dialling $number...(attempt %n)
  111.   output "atdt"$number\13
  112.   %busy = [input %busytimeout BUSY]
  113.   if %busy
  114.     status "The line is busy...pausing for a while"
  115.     sleep %busywait
  116.     %ok = 0
  117.   else
  118.     %ok = [input %connecttimeout CONNECT]
  119.   end
  120. until %ok
  121. input 10 \n
  122. #
  123. #  wait till it's safe to send because some modem's hang up
  124. #  if you transmit during the connection phase
  125. #
  126. wait %onlinetimeout dcd
  127. status Connected.  Now logging in as $username...
  128. #
  129. # now prod the terminal server
  130. #
  131. #output \13
  132. #
  133. #  wait for the username prompt
  134. #
  135. input %logintimeout $userprompt
  136. output $username\13
  137. #
  138. # and the password
  139. #
  140. input %logintimeout $passprompt
  141. output $password\13
  142. #
  143. # we are now logged in
  144. #
  145. status "Logged in. Now switching to Internet..."
  146. input %prompttimeout $choiceprompt
  147. if %ppp
  148.   #
  149.   # jump into ppp mode
  150.   #
  151.   output $pppcmd\13
  152.   #
  153.   # wait for PPP prompt.
  154.   # input %prompttimeout $pppready
  155.   #
  156.   display \n\n"PPP mode selected.  Will try to negotiate IP address."\n
  157.   status "PPP mode selected.  Will try to negotiate IP address."
  158.   sleep 1
  159.   #
  160. else
  161.   #
  162.   # jump into slip mode
  163.   #
  164.   output $slipcmd\13
  165.   #
  166.   # wait for the address string
  167.   #
  168.   input %addresstimeout $addrtarg
  169.   #
  170.   # parse address
  171.   #
  172.   address 30
  173.   input %addresstimeout \n
  174.   #
  175.   # we are now connected, logged in and in slip mode.
  176.   #
  177.   display \n
  178.   display Connected.  Your IP address is \i.\n
  179.   status Connected.  Your IP address is \i.
  180.   sleep 1
  181. end
  182. #
  183. # now we are finished.
  184. #
  185.