VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Python Script - Creating a new tab/session (https://forums.vandyke.com/showthread.php?t=14128)

dougbert 03-27-2020 01:24 PM

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?

berdmann 03-27-2020 02:57 PM

2 Attachment(s)
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.
https://forums.vandyke.com/attachmen...achmentid=1872
I have also attached an example script, "ConnectToMultipleHostsInTabs.py.txt", that you will likely find helpful.

Does this information help you to get started?

dougbert 03-31-2020 12:36 PM

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()


berdmann 03-31-2020 12:53 PM

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! :)


All times are GMT -6. The time now is 05:18 PM.