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 03-27-2020, 01:24 PM
dougbert dougbert is offline
Registered User
 
Join Date: Dec 2019
Posts: 5
Python Script - Creating a new tab/session

I'm having trouble figuring out how to get my python script started. I need to create a script that starts by creating a new session/tab. I want to make sure when you launch the script it starts by creating a new tab/session (in whatever order that should happen). I'm getting lost in the documentation on how to generate that at the beginning.

What am I missing here to get this off the ground?
Reply With Quote
  #2  
Old 03-27-2020, 02:57 PM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 352
Hi dougbert,

Can you please elaborate on where you are getting lost in the documentation?

You will want to take a look at the 'Session' object and the 'ConnectInTab' method in SecureCRT's Help.
I have also attached an example script, "ConnectToMultipleHostsInTabs.py.txt", that you will likely find helpful.

Does this information help you to get started?
Attached Images
File Type: png SecureCRT_Help_Scripting_SessionObject.png (79.6 KB, 184 views)
Attached Files
File Type: txt ConnectToMultipleHostsInTabs.py.txt (2.6 KB, 78 views)
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 03-31-2020, 12:36 PM
dougbert dougbert is offline
Registered User
 
Join Date: Dec 2019
Posts: 5
Thanks Brittney,

The Session/ConnectInTab function was what I was looking for. I've got a script working now that will read in a CSV file that contains a list of hosts and a list of interfaces that need to be reconfigured. I needed the script to connect to each host and then parse the interfaces out and perform commands on each of them and then save.

I ended up using function from the RunCommandsonMultipleHostsAndLogResults to close the tabs each host ends up opening up:
Code:
if g_objNewTab.Index <> crt.GetScriptTab().Index:
            g_objNewTab.Close()
Reply With Quote
  #4  
Old 03-31-2020, 12:53 PM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 352
Hi dougbert,

Thanks for following up!

I am glad to hear that the ConnectInTab method worked well for you and that you were also able to make use of the "RunCommandsonMultipleHostsAndLogResults" script example!

Thanks for sharing! Keep Well!
__________________
Thanks,
--Brittney

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

Tags
launch , python , session , tab


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 09:26 AM.