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-18-2018, 12:41 PM
jdavee jdavee is offline
Registered User
 
Join Date: Apr 2018
Posts: 2
Get screen dimensions

New to SecureCRT and VBScript. Simple question but I'm not finding the answer.

I'm writing a script that will capture the currently displayed screen then open Notepad with that text. Easy enough and I've found very close examples except they don't just grab the displayed text automatically.

Some of my sessions use different screen dimensions. I want to get the current number of displayed rows and columns to use in the Get2() function since these values will differ.

I'm probably missing something obvious, but I'm not getting the Rows and Columns values returned in the script. I've tried Rows, crt.Rows, object.Rows, etc. but I'm not getting the numeric value back.

I'm assuming that the value returned is the currently visible row and column count.

Where am I making my silly mistake?
Reply With Quote
  #2  
Old 04-18-2018, 12:49 PM
jdavee jdavee is offline
Registered User
 
Join Date: Apr 2018
Posts: 2
Found it...

Of course I found it just minutes after posting the question...

From the Scripting Essentials PDF document I found an example using

crt.Screen.Rows
crt.Screen.Columns

Which does give me the displayed screen dimensions.

Might I suggest that the Help system saying "object.Rows" in the usage example be enhanced by giving some available objects like crt.Screen.Rows?
Reply With Quote
  #3  
Old 04-18-2018, 01:05 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 836
Quote:
Originally Posted by jdavee View Post
I'm writing a script that will capture the currently displayed screen then open Notepad with that text.
...
I've tried Rows, crt.Rows, object.Rows, etc. but I'm not getting the numeric value back.

Where am I making my silly mistake?
The correct syntax, as you have discovered, would be to use the Rows property of the Screen object. Screen objects are either associated with:
  • The Application object itself (the crt main level object, in which case the Screen object that is returned is *always* the screen associated with the tab/tile that is active when the script is first launched)

    or

  • A specific Tab object (which you can get by calling crt.GetTab(1) for the first tab, crt.GetTab(2) for the 2nd tab, and so on, or even just crt.GetScriptTab() to get a reference to the actual tab that is running the script).


Quote:
Might I suggest that the Help system saying "object.Rows" in the usage example be enhanced by giving some available objects like crt.Screen.Rows?
I'll create a request to improve the help by describing what "object" means and giving an example in the Get2() reference.

In the mean time, you might be able to save yourself some time by using one of the example scripts on our example scripts "sticky", since I think one of them does exactly what you desire. Does the example in the Save Screen Text to a File post get you pretty close to what you need if you either set the line g_strMode = "screen" or specify a command line arg to your script a la /MODE:screen ?

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
support@vandyke.com
http://www.vandyke.com/support
Reply With Quote
Reply

Tags
screen size row column


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:40 AM.