VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Grabbing a long list of data output from screen (

yuvi 06-08-2016 02:22 AM

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,


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,

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),



Instead all am getting in my textfile is,


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!


rtb 06-08-2016 11:04 AM

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:
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?

yuvi 06-08-2016 06:46 PM

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


crt.Screen.Synchronous = True

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

crt.Screen.WaitForString vbcr

strCompleteOutput = ""


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

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.

rtb 06-09-2016 11:09 AM

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.

Rhudi 07-08-2016 08:03 AM

In Cisco devices, "terminal length 0" stops the 'more' prompt.

Juniper: "set cli screen-length 0"

Most router have a similar option.

All times are GMT -6. The time now is 05:59 AM.