View Single Post
  #1  
Old 01-25-2020, 06:28 AM
Hamza Hamza is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
Possible to run "crt.Screen.WaitForString" in a permanent loop?

Hello,

I would like SecureCRT to look for the "Username:" prompt on my screen and automatically type out my two Cisco logins. However, I need this script to be constantly vigilant for the prompt because I often connect to several telnet devices in a row.

Below is my example script. It works for the 1st cisco device I log into, but when I try to trigger it for the 2nd cisco device, sadly nothing happens.

Any idea what I'm doing wrong? Any help is appreciated.

Code:
# $language = "VBScript"
# $interface = "1.0" 


Sub Main ()

crt.Screen.Synchronous = True

Do
		crt.Screen.WaitForString "Username:"
		crt.Screen.Send "Thomas" & vbCr
		crt.Screen.WaitForString "LocalPassword:"
		crt.Screen.Send "Password123" & vbCr & vbCr
		crt.Screen.WaitForString "login:"
		crt.Screen.Send "Thomas" & vbCr
		crt.Screen.WaitForString "Password:"
		crt.Screen.Send "Password123" & vbCr & vbCr
Loop

End Sub
Reply With Quote