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 07-16-2018, 09:48 AM
cguillaume cguillaume is offline
Registered User
 
Join Date: Jul 2018
Posts: 3
[Python] Renam tab in a script

Hello,

is it possible to rename a tab inside a script ?
I created a script which open many tab (on for each of my switches) by taking an input file containing a list of IP addresses.

Code:
cmd = "/SSH2 /L %s /PASSWORD %s /C AES-128-CTR,AES-128 /M SHA1 %s" % (user, passwd, ip_address)
		crt.Session.ConnectInTab(cmd)
each tab has the ip_addr as name. Is it possible to modify it in the script ?

best regards
Reply With Quote
  #2  
Old 07-16-2018, 10:10 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 559
Hi cguillaume,

It is possible to rename tabs from within a script. This is done with the Caption property of the Tab object. I've included a brief example below.

Code:
# $language = "Python"
# $interface = "1.0"

objTab = crt.GetScriptTab()
objTab.Caption = "This is the new tab name"
For further information on the available Properties/Methods please review the scripting information available in SecureCRT's help file. While in the Contents tab choose Scripting then Script Objects Reference.

Does this help get you the functionality you're looking for?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 07-16-2018, 10:15 AM
cguillaume cguillaume is offline
Registered User
 
Join Date: Jul 2018
Posts: 3
It is exactly that
thank you
Reply With Quote
  #4  
Old 07-16-2018, 10:45 AM
cguillaume cguillaume is offline
Registered User
 
Join Date: Jul 2018
Posts: 3
I have another question linked to this subject.

Is it possible to get the active tab name in a script, in order to be sure that a specific script is executed from the right tab ?
Reply With Quote
  #5  
Old 07-16-2018, 10:58 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 559
cguillaume,

It is, you would use the same Caption property.

Code:
objTab = crt.GetScriptTab()
strTabName = objTab.Caption

crt.Dialog.MessageBox(strTabName)
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


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 03:31 AM.