Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
2.6 KiB

  1. ;
  2. ; This is a script file that demonstrates how
  3. ; to establish a SLIP connection with a host
  4. ; that uses a menu system.
  5. ;
  6. ; A script file must have a 'main' procedure.
  7. ; All script execution starts with this 'main'
  8. ; procedure.
  9. ;
  10. ; Main entry point to script
  11. ;
  12. proc main
  13. ; Change these variables to customize for your
  14. ; specific Internet service provider
  15. integer nTries = 3
  16. ; This is the login prompt and timeout values
  17. string szLogin = "username:"
  18. integer nLoginTimeout = 3
  19. ; This is the password prompt and timeout values
  20. string szPW = "password:"
  21. integer nPWTimeout = 3
  22. ; This is the prompt once your password is verified
  23. string szPrompt = "annex:"
  24. ; This is the command to send to establish the
  25. ; connection. This script assumes you only need
  26. ; to issue one command to continue. Feel free
  27. ; to add more commands if your provider requires
  28. ; it.
  29. ;
  30. ; This provider has a menu list like this:
  31. ;
  32. ; 1 : Our special GUI
  33. ; 2 : Establish slip connection
  34. ; 3 : Establish PPP connection
  35. ; 4 : Establish shell access
  36. ; 5 : Download our software
  37. ; 6 : Exit
  38. ;
  39. ; annex:
  40. ;
  41. string szConnect = "2^M"
  42. ; Set this to FALSE if you don't want to get an IP
  43. ; address
  44. boolean bUseSlip = TRUE
  45. ; -----------------------------------------------------
  46. ; Delay for 2 seconds first to make sure the
  47. ; host doesn't get confused when we send the
  48. ; two carriage-returns.
  49. delay 2
  50. transmit "^M^M"
  51. ; Attempt to login at most 'nTries' times
  52. while 0 < nTries do
  53. ; Wait for the login prompt before entering
  54. ; the user ID, timeout after x seconds
  55. waitfor szLogin then DoLogin
  56. until nLoginTimeout
  57. TryAgain:
  58. transmit "^M" ; ping
  59. nTries = nTries - 1
  60. endwhile
  61. goto BailOut
  62. DoLogin:
  63. ; Enter user ID
  64. transmit $USERID, raw
  65. transmit "^M"
  66. ; Wait for the password prompt
  67. waitfor szPW until nPWTimeout
  68. if FALSE == $SUCCESS then
  69. goto TryAgain
  70. endif
  71. ; Send the password
  72. transmit $PASSWORD, raw
  73. transmit "^M"
  74. ; Wait for the prompt
  75. waitfor szPrompt
  76. transmit szConnect
  77. if bUseSlip then
  78. ; An alternative to the following line is
  79. ;
  80. ; waitfor "Your address is "
  81. ; set ipaddr getip
  82. ;
  83. ; if we don't know the order of the IP addresses.
  84. set ipaddr getip 2
  85. endif
  86. goto Done
  87. BailOut:
  88. ; Something isn't responding. Halt the script
  89. ; and let the user handle it manually.
  90. set screen keyboard on
  91. halt
  92. Done:
  93. endproc