Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2  
Old 01-25-2020, 11:13 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,228
Hi Hamza,

Are you sure the prompt from all remotes is "Username:"? (Including a capital 'U'?)

Many OSes are case sensitive. This is why you will see our examples leaving off the first letter of a common prompt, using "sername:" or "ogin:" instead.

So you can cover multiple possibilities with a WaitForStrings() (plural) or just "waitfor" the part of the prompt which is expected to be common among all the devices.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 01-29-2020, 01:57 AM
Hamza Hamza is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
Hey bgagnon,

Using "sername:" and "ogin:" did the trick.

Appreciate your fast response.
Reply With Quote
  #4  
Old 01-29-2020, 08:04 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,228
Hi Hamza,

Great! Thanks for posting an update!
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:22 PM.