VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Caption of active tab (https://forums.vandyke.com/showthread.php?t=14524)

fabb 05-13-2021 05:36 AM

Caption of active tab
 
Hello,

Since I upgraded to latest version of SecureCRT (9.0.1), the caption of the active tab is not changed any more by my script.

I open a ssh session (File->Connect in tab), and then I run a VBS script.

When the following line is executed
Code:

crt.window.Caption = hostname
with my old SecureCRT versions, the caption of the current tab was changed with the content of the 'hostname' varaible.

With my new SecureCRT version, the caption of SecureCRT windows is changed with the content of the 'hostname' varaible
(and the caption of the current tab is the propmt of the ssh session).

I tried several things but I do not manage to change the caption of the active tab.

Any idea ?

Thank you!

Below an extract of the script:
Code:

# $language = "VBScript"
# $interface = "1.0"

Sub main

crt.Screen.Synchronous = True

...

hostname = ......

...

crt.window.Caption = hostname

crt.Screen.Synchronous = False

End Sub


cboyack 05-13-2021 09:22 AM

Hi fabb,

If you would be so kind as to take a look at the Scripting topic in SecureCRT's Help Window, you can see that there are both Tab and Window objects.

Per the information in the Help, the crt.Window.Caption object returns or sets the title or caption of SecureCRT's application window.

The tab.Caption object returns or sets the caption of the specified tab object.

What happens if you start using the Tab-based object in your script instead of the Window-based object?

fabb 05-13-2021 12:27 PM

Thanks!

I tried
Code:

tab.Caption = hostname
it results in the error:

Quote:

Microsoft VBScript runtime error
Error: Object doesn't support this property or method: 'tab'
I also tried :

Code:

crt.tab.Caption = hostname
and
Code:

set tab.Caption = hostname
and I get the same error message.

cboyack 05-13-2021 01:38 PM

Hi again fabb,

I apologize for not sharing with you a working example. My bad.

Here's an example of how to get at the tab object:

Code:

Set objTab = crt.GetScriptTab
objTab.Caption = hostname

FYI, the tab.Caption property will also change the window title of the main SecureCRT app, and this is by design. With few exceptions (one of which is launching the app with the /TITLEBAR CLI option), the SecureCRT main application window title always reflects the caption of the current/active tab. So, when you set the tab title, you're also changing what gets displayed in the window title.

fabb 05-14-2021 02:14 AM

It works fine with your new code, thanks for your support !

cboyack 05-14-2021 07:12 AM

Excellent! I'm glad that you were able to get things working.


All times are GMT -6. The time now is 04:16 PM.