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 04-19-2012, 12:18 PM
rainman rainman is offline
Registered User
 
Join Date: Apr 2012
Posts: 16
if Crt.Screen.WaitForString

Hello, can someone please advise why the following script is not working ?

crt.Screen.WaitForString "# "
crt.Screen.Send "show names" & chr(13)
if crt.Screen.WaitForString ("More") = True then
crt.Screen.Send " " & chr(13)
else
crt.Screen.WaitForString "# "
crt.Screen.Send "show usage" & chr(13)
end if
Reply With Quote
  #2  
Old 04-19-2012, 01:05 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi rainman,

Thanks for the question.

If that is the entire script you are using, the I would suggest adding the following:
PHP Code:
crt.Screen.Synchronous True 
This Synchronous property is usually necessary to prevent the script from missing data from the remote.

Does this help to resolve the issue?

If not, would you post your entire script?

As a note, it may be easier to disable paging for the duration of the connection rather than try to deal with the more prompts.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 04-20-2012, 03:20 AM
rainman rainman is offline
Registered User
 
Join Date: Apr 2012
Posts: 16
if Crt.Screen.WaitForString

Hello Todd, Thank you for the reply. I have added the full script below. I can't figure it out, but for some reason the script does not get to line 18. I believe the issue maybe related to the "if and else " statements. The crt.Screen.Synchronous = True statement was already part of the script. Your help is much appreciated. Thanks.

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

crt.Screen.Synchronous = True

Sub Main
crt.Screen.Send "telnet 10.1.1.1" & chr(13)
crt.Screen.WaitForString "login: "
crt.Screen.Send "rainman" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "pass123" & chr(13)
crt.Screen.WaitForString "> "
crt.Screen.Send "show connections" & chr(13)
if Crt.Screen.WaitForString ("More") = True then
crt.Screen.Send " " & chr(13)
else crt.Screen.WaitForString "> "
end if
crt.Screen.Send "show all ports" & chr(13)
crt.Screen.WaitForString "> "
crt.Screen.Send "logout" & chr(13)
End Sub
Reply With Quote
  #4  
Old 04-20-2012, 09:22 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi rainman,

As I mentioned previously, it would be easier to turn of paging, run the command, and then enable paging when you are done.

If for some reason that is not possible, we have an example in our scripting manual that may be of assistance as you write your script. You can find the scripting manual at the following location:
http://www.vandyke.com/support/tips/...ing/index.html
The example is in the Using MatchIndex to Determine Which String ReadString() Detected section on page 51.

Does this help you fix your script?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #5  
Old 04-20-2012, 09:34 AM
rainman rainman is offline
Registered User
 
Join Date: Apr 2012
Posts: 16
Thank you Todd
Reply With Quote
  #6  
Old 04-20-2012, 10:08 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
You are welcome rainman. I am glad I could help.
__________________
--Todd

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 07:20 AM.