VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Create tab group in script? (

awittenb 01-09-2018 04:32 PM

Create tab group in script?
I have a logon script that opens a bunch of tabs which works fine. I would like to be able to send some of those tabs to a new tab group once I'm logged in. Is it possible to create a tab group from a script? I don't see anything in the reference for this.

berdmann 01-09-2018 05:34 PM

There is not currently any scripting API for managing tab groups nor moving tabs from one tab group to another.

I've added a feature request for you.

Depending on how complex you need things to be, you can effectively get new sessions opened in a tab group using this method:
  1. Connect to all sessions you desire to exist in left-most tab group first.

  2. Connect to the first session of your new tab group. After connection is successful, use the following statement to send the active tab (the most recent connected) to a new tab group:

  3. Any ConnectInTab calls you make from here on will open tabs in the new tab group.

Here's an example:

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

crt.Session.Connect("/S ""Session 1""")
crt.Session.ConnectInTab("/S ""Session 2""")
crt.Session.ConnectInTab("/S ""Session 3""")

' Connect to first session desired for new tab group:
crt.Session.ConnectInTab("/S ""Session 4""")
' Send that tab to a new group

' From here on out, any new connections in tabs will appear
' in the new tab group:

crt.Session.ConnectInTab("/S ""Session 5""")
crt.Session.ConnectInTab("/S ""Session 6""")

' Activate all the existing tabs one by one, and
' rename them:

For i = 1 to crt.GetTabCount
    crt.GetTab(i).Caption = "Tab " & i

awittenb 01-09-2018 06:57 PM

Thanks so much. This worked perfectly.

Python code I'm using in case anyone else finds it useful:


# $language = "python"
# $interface = "1.0"

    ('s1', '', False),
    ('s2', '', False),
    ('s3', '', True),
    ('s4', '', False),

def Main():
    for (caption, server, new_tab_group) in SERVERS:
        tab = crt.Session.ConnectInTab('/s jumpserver', True)
        tab.Caption = caption
        tab.Screen.WaitForString('> ')
        tab.Screen.Send('ssh %s\r' % server)

        if new_tab_group:


berdmann 01-10-2018 09:32 AM

You are very welcome! I am happy to hear that it worked well for you! :)

Thanks for sharing!

All times are GMT -6. The time now is 01:33 PM.