Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 02-13-2018, 10:39 AM
Hang Hang is offline
Registered User
Join Date: Jul 2016
Posts: 21
Post scripting hanging at if waitforstring statement

I was wondering if you guys have a suggestion for a better way of cycling through password.

My current script always hang at the if statement.

Here is my code:
prompt = "A:"
currentTab = crt.GetScriptTab()
password = ["wrongPass", "rightPass"]

def main():		
	x = 0
	currentTab.Screen.Synchronous = True		
	while currentTab.Screen.WaitForString("assword:") == True:
		if currentTab.Screen.WaitForString(prompt) == True:			
			x = x + 1		

Here is my output:
*A:# kernel
MINOR: CLI Unidentified command.
*A:# kernel
Type "exit" to return to CLI.
As you can see the right password was enter on the second try. However, the script will hang at the waitforstring(prompt) line of code and never send the "finished" string. It is waiting for "A:" but we already log into the kernel and it doesn't go to the else statement to break out of the while loop.
Reply With Quote

if statement , waitforstring

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 12:31 AM.