|
#1
|
|||
|
|||
Script to resize window?
I would like to create a script to resize the SecureCRT window. I'm not able to find an example or document for the objects/API that would do this. The end goal is to map Alt-R to the script so that it resizes the window to a set size (50 rows, 100 columns). Any help would be appreciated.
Last edited by jake1138; 05-04-2017 at 11:26 AM. |
#2
|
|||
|
|||
Hi jake1138,
I think this may be something better suited bot the Button Bar. The Button Bar --> View > Button bar Use the button bar to map buttons to the script. https://www.vandyke.com/support/tips/button_bar.html I've included a very brief script example that seems to accomplish what you are looking for. Code:
# $language = "VBScript" # $interface = "1.0" crt.session.config.setoption "Rows", "50" crt.session.config.setoption "Cols", "100" There are a few additional things you may want to keep in mind when working with screen geometry. When you connect a session, the window will resize based on the settings in that session regarding rows/columns and the "On resize" configuration. When not connected, SecureCRT should be getting that info from the Default Session. Those configuration options are found in the 'Terminal / Emulation' category of Session Options (or Default Session): https://www.vandyke.com/support/tips/defaultset.html Every connection from then on, if you are connecting sessions in tabs, is also going to be controlled by the configuration in that first tabbed session. This will mean if you have multiple sessions opened and you try to set the rows/columns for a tab other than the first tab it will not have an effect.
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
That almost does what I want. It dynamically resizes the window height to 50 rows but it resizes the window width to 256 columns! It doesn't matter what value I give it for Cols, it always resizes to 256.
|
#4
|
|||
|
|||
Hi jake1138,
If you navigate to Options > Session Options then select the Terminal > Emulation category you will find a On Resize option. What do you have selected? This might also be affecting the way your text is displayed. The "Synchronize view to size" option will allow you to set your font size, but when you resize the window, your rows and columns settings will change to fill up the window. The "Scale the font" option will allow you to set your rows and columns settings and when you resize the window, the font will grow or shrink so that your rows and columns can stay constant so that the whole window gets filled up. The "Retain size and font" option will allow you to set your font size and your rows and columns so that they all remain constant, even if it means that you have extra blank space in your window or if the window is too small to see everything.
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#5
|
|||
|
|||
If I go to Options > Session Options > Emulation and set the "Logical rows" and "Logical columns" it works as expected. If I set the rows to 50 and columns to 100 and click OK, the Windows resizes just fine. Why doesn't the script behave the same way?
Under "On resize", I have it set to "Synchronize view to size" which I assume is the default because I've never changed that. The "Scale the font" option definitely isn't what I want as that makes the font tiny and it only shows text in a small portion of the window (and resizing the window doesn't change that). I looked further and found that it changed my font from "vt100 10pt" to "vt100 5pt". I had to manually change that back to fix the problem. |
#6
|
|||
|
|||
SOLVED: I upgraded to SecureCRT 8.1.2 and now the script works as expected. So it looks like it was a bug in the old version (7.1.1).
By the way, I mapped Alt-R to execute the script and it does exactly what I want. Thanks for your help! |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|