Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #16  
Old 01-18-2016, 11:50 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
I can explain this in more detail.
strResult = crt.Screen.ReadString(vbcrlf)
Your line of code above tells ReadString() to start capturing data until it finds a carriage return and a line feed. When ReadString() finds this set of characters, it returns the data captured in the form of a variable named strResult.

Jake indicated that you need to modify the line above to look for your shell prompt rather than a carriage return and a line feed. For example, if your prompt is my_prompt$, you would modify your line of code as follows:
strResult = crt.Screen.ReadString("my_prompt$")
Making this modification will tell ReadString() to capture date until it finds the string my_prompt$ at which time it will return the captured data in the form of the variable strResult.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #17  
Old 01-19-2016, 10:24 AM
e2script e2script is offline
Registered User
 
Join Date: Sep 2014
Posts: 34
Quote:
Originally Posted by rtb View Post
I can explain this in more detail.
strResult = crt.Screen.ReadString(vbcrlf)
Your line of code above tells ReadString() to start capturing data until it finds a carriage return and a line feed. When ReadString() finds this set of characters, it returns the data captured in the form of a variable named strResult.

Jake indicated that you need to modify the line above to look for your shell prompt rather than a carriage return and a line feed. For example, if your prompt is my_prompt$, you would modify your line of code as follows:
strResult = crt.Screen.ReadString("my_prompt$")
Making this modification will tell ReadString() to capture date until it finds the string my_prompt$ at which time it will return the captured data in the form of the variable strResult.
That's actually exactly what I tried out before asking about a more detailed explanation.
The reason I asked for the detailed explanation is because I tried what you suggested above, but it didn't work.

I tried it again now, but it still doesn't work.
Any good way to troubleshoot this?
Reply With Quote
  #18  
Old 01-19-2016, 12:10 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
It isn't clear how "it didn't work".

Are you stating that strResult is still empty?

If so, you might consider recording a script in SecureCRT. A SecureCRT recorded script in conjunction with a raw log can help as you debug your script code. When using a recorded script, a key point to compare is the prompt that is recorded vs. the prompt you have in your script code.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730

Last edited by rtb; 01-19-2016 at 01:01 PM.
Reply With Quote
Reply

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 04:30 AM.