VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   How use Screen->Get() for a line that is off the screen (https://forums.vandyke.com/showthread.php?t=11118)

thehawk 07-12-2013 06:58 PM

How use Screen->Get() for a line that is off the screen
 
Hello,

I'm using SecureCRT version 6.2.2 with Active Perl Scripting.

I'm creating a script that grabs information from a remote router by connecting to the remote device via TELNET or SSH. When the "show" command is executed the output is longer than it can be displayed in a single window and the window starts scrolling up. As such, the Screen->Get(10,1, 10,10) for example no longer corresponds to the line I wanted to grab.

Since the lines I need are off the screen I tried to use negative lines for the numbers but for some reason it doesn't work.
I.E. I tried Screen->Get(-4,1 -4,10) but didn't work.

Can you please advise if there is a way to have the script grab the line number based on the number of lines that have displayed since the connection was established (not based on what's on the screen only) or is there a way to grab information that has already passed the screen?

Thank you,
Adrian

thehawk 07-13-2013 07:24 AM

Found a work-around for now. I've modified the Global settings to use a smaller font. Since the output of the command initially was only 1 page and a half when I shrunk the font the output came down to 1 page which I was able to parse using the Get() function.

I would still be interested in knowing how to parse for negative lines or how to output everything for that command to an array that I can then take apart line by line so that I can get the output that I want.

Thank you for your help,
Adrian

rtb 07-15-2013 08:33 AM

Hi Adrian,

I am glad to hear that you found a workaround. I would suggest that you take a look at the scripting manual. It illustrates the SecureCRT scripting API in conjunction with VBScript, but the API concepts are the same.

You can find it at the following location:
http://www.vandyke.com/support/tips/...ing/index.html
Chapter 4 will likely be most useful for your current project.

Rather than using Get(), I would suggest taking a look at ReadString(). Does ReadString() help you accomplish your goal?


All times are GMT -6. The time now is 06:45 AM.