VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Create a tab to connect and then use that tab in connection loop (https://forums.vandyke.com/showthread.php?t=12655)

Torrezno 04-05-2017 05:16 AM

Create a tab to connect and then use that tab in connection loop
 
Hi there,

I want to create a new tab with a connection:

Set tab = crt.Session.ConnectInTab("/FIREWALL /Telnet A.B.C.D0")

Then do stuff, and then disconnect that tab and reuse it for another connection in a looop:

tab.Session.Disconnect
tab.Session.Connect ("/FIREWALL /Telnet A.B.C.D1")
tab.Session.Disconnect
...
tab.Session.Connect ("/FIREWALL /Telnet A.B.C.DN")


This code is not working because it get stuck in the 2nd disconnect not showing the prompt till I stop the script and then show the prompt of the second telnet. (I'm currently using just 2 without a loop to build it incrementally.

I guess there is something wrong in the code but can't find where and googling didn't help.

Anyone knows what's the issue?

Thanks!

ekoranyi 04-05-2017 08:48 AM

Hi Torrezno,

Will you be running the same commands on each host you connect to?

If so we have an example script that may accomplish what you are looking for.

I've included code below. In my testing using blocks like this seems to provide the functionality you are looking for.

Code:

  crt.session.ConnectInTab("/FIREWALL /Telnet A.B.C.D0")
  crt.Screen.Synchronous = True
  <Commands you want to run>
  crt.Session.Disconnect

  crt.session.ConnectInTab("/FIREWALL /Telnet A.B.C.D1")
  crt.Screen.Synchronous = True
  <Commands you want to run>
  crt.Session.Disconnect

Does this help?


All times are GMT -6. The time now is 12:49 PM.