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 05-21-2013, 09:45 AM
gunslingor gunslingor is offline
Registered User
 
Join Date: May 2013
Posts: 27
Prompt Value

What's the best most sure proof way of determining what the prompt value is... also is there a way to disable the "--more--" prompt?

I need the prompt value so that I can use the readstring method without having to change things manually for the ending string... some of our devices use # or > plus the host name as the prompt and I want to make sure the prompt isn't part of the read string.

I also want to get rid of the "--more--" prompt because it requires that you press spacebar or something to see subsequent pages, but this spacebar or similar press appears to be stored with the readstring, which is making parsing the output even more difficult.

Any timely help is appreciated.
Reply With Quote
  #2  
Old 05-21-2013, 11:13 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi gunslingor,

Your question about the --more-- prompt is a Cisco configuration question. There will likely be some way to disable paging on the Cisco device. I would suggest consulting the documentation of the device to see what is possible.

With regards to the prompt, there is no sure way to always get the prompt, but we do have an example that might help which is located in the following post:
http://forums.vandyke.com/showthread...7294#post37294
The example has a function named WaitForScreenContentsToStopChanging() that illustrates a way to capture a prompt.

Does this help?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 05-22-2013, 04:13 AM
GJB56 GJB56 is offline
Registered User
 
Join Date: Nov 2011
Posts: 22
One way to handle multiple prompts would be to build an array with the possible prompts. Then use crt.screen.WaitForStrings and Case statements to take action based on the prompt. Here is an unrefined example:

Sub WaitFor()

Dim vWaitString
vWaitString = Array ("A2200> ", strNewPrompt & "> ", "Do you want to continue", "Press any key to continue", "Login:")

Do
Dim btnResult
btnResult = crt.Screen.WaitForStrings (vWaitString)

Select Case btnResult
Case 1 'A2200 prompt
crt.sleep 100
exit do
Case 2
crt.sleep 100
exit do
Case 3
crt.Screen.Send "y" & chr(13)
crt.sleep 100
Case 4 'Press any key until prompt changes
crt.Screen.Send "z"
crt.sleep 100
Case 5 'Login
crt.sleep 100
crt.Screen.Send "root" & chr(13)
crt.Screen.WaitForString "Password:"
crt.Screen.Send "root" & chr(13)
End Select
Loop

End Sub
Reply With Quote
  #4  
Old 05-22-2013, 05:37 AM
gunslingor gunslingor is offline
Registered User
 
Join Date: May 2013
Posts: 27
Thanks guys, I might try these solutions. I'm also considering the command:
"show run | include hostname" since all our prompts start with a hostname followed by ">" or "#".
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 10:34 PM.