example2.vbs 760 B

123456789101112131415161718192021222324252627
  1. #$language = "VBScript"
  2. #$interface = "1.0"
  3. Sub main
  4. Dim passwd
  5. ' turn on synchronous mode so we don't miss any data
  6. crt.Screen.Synchronous = True
  7. ' Wait for a string that looks like "login: " or "Login: "
  8. crt.Screen.WaitForString "ogin: "
  9. ' Send your username followed by a carriage return
  10. crt.Screen.Send "username" & VbCr
  11. ' Wait for a tring that looks like "password: " or "Password: "
  12. crt.Screen.WaitForString "assword:"
  13. ' prompt the user for a password
  14. passwd = crt.Dialog.Prompt("Please enter your password:", "Enter Password", "", True)
  15. ' send the password and a carriage return
  16. crt.Screen.Send passwd & VbCr
  17. ' turn off synchronous mode to restore normal input processing
  18. crt.Screen.Synchronous = False
  19. End Sub