Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-08-2016, 01:22 AM
yuvi yuvi is offline
Registered User
 
Join Date: Jun 2016
Posts: 2
Grabbing a long list of data output from screen

Hi guys,

So am trying to grab a whole lot of output of a command from the command line.

I am using crt.screen.send to punch the command on to the CLI and using a temporary text file to read each line.

Here is what am doing,

Quote:

crt.screen.send "show port " & vPort &vbcrlf &vbcrlf

crt.screen.send vbcrlf

crt.Screen.WaitForString vbcrlf, 10

crt.screen.send "#" &vbcrlf




crt.Screen.WaitForString vbcr, 10

vPortFetchLine = crt.Screen.ReadString("#")
Then I am using a writeobj to write it on to a temporary text file and then read the same from it.

The problem with this is that I can't read the lines after certain lines which in real time would require me to hit a spacebar. I am using vbcrlf to display all the output on the screen but am only able to grab the lines or output before I am giving the command "vbcrlf"


for instance if have several lines as output,

line1
line2
.
.
.
.
line30
Press any key to continue (Q to quit)
This is where I am required to hit spacebar in real time when working with script.

I gave several vbcrlf to overcome the challenge of hitting spacebar in the script.

What am unable to do though is not able to grab the entire output all am getting is till Press any key to continue (Q to quit), although I can literally see the rest of the output being displayed on the screen.

So it should be something like this (assuming am getting 60 lines on the screen),

Quote:

line1
line2
.
.
.
.
line60
Instead all am getting in my textfile is,

Quote:

line1
line2
.
.
.
.
line30
Press any key to continue (Q to quit)

I may sound crazy, I hope I conveyed my point. Please correct my mistake and help me read all the output of this particular command.

Thanks in advance!

Yuvi
Reply With Quote
  #2  
Old 06-08-2016, 10:04 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi Yuvi,

Thanks for the post.

An example of how one could accomplish your goal is included in the scripting manual at the following location:
https://www.vandyke.com/support/tips...ing/index.html
The example begins on page 50 with the heading of: Using MatchIndex to Determine Which String ReadString() Detected.

Does this help you accomplish your goal?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 06-08-2016, 05:46 PM
yuvi yuvi is offline
Registered User
 
Join Date: Jun 2016
Posts: 2
Thanks for the reply rtb!

I tried that already, gave it another go, still I am unable to read all the data output of my command "show port"

All this does is matching the index to the string where you need a space, gives a space and displays the whole data on to the screen.

But, still unable to read the whole data.

Here is what I did, (FYI, I am not working with CISCO, its Bastian, if that helps

Quote:

crt.Screen.Synchronous = True

crt.screen.send "show port " & vport & vbcr

crt.Screen.WaitForString vbcr

strCompleteOutput = ""

Do


strResult = crt.Screen.ReadString("* indicates that the corresponding row element may have been truncated.", "Symbol Errors")



strCompleteOutput = strCompleteOutput & strResult

If crt.Screen.MatchIndex = 1 Then crt.Screen.Send " "

If crt.Screen.MatchIndex = 2 Then Exit Do
Loop

strCompleteOutput = Replace(strCompleteOutput, _
vblf & vbcr & vbcr & " " & vbcr, vblf & vbcr)

MsgBox strCompleteOutput

Still it just reads the output till before "* indicates that the corresponding row element may have been truncated"

I want he output till "symbol Errors"

which is not happening.
Reply With Quote
  #4  
Old 06-09-2016, 10:09 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi Yuvi,

What version of SecureCRT are you using?

I don't have any familiarity with Bastian.

Would you be able to post the output of the command?
NOTICE: The requested troubleshooting data may include sensitive information (usernames, passwords, publicly-accessible host names or IP addresses, etc.).

Please redact sensitive information that would not be appropriate for a public forum prior to posting the requested information.

If there is sensitive information that must be conveyed in order to provide a complete picture of the scenario you're facing, please let us know and we will set up a secure upload mechanism that can be used.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #5  
Old 07-08-2016, 07:03 AM
Rhudi's Avatar
Rhudi Rhudi is offline
Registered User
 
Join Date: Jul 2013
Location: Greenville, SC
Posts: 97
In Cisco devices, "terminal length 0" stops the 'more' prompt.

Juniper: "set cli screen-length 0"

Most router have a similar option.
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:42 PM.