Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-18-2018, 11:24 AM
cynarl cynarl is offline
Registered User
 
Join Date: Sep 2018
Posts: 2
run function in all active sessions

I created a script to send multiple commands in all active sessions, but these commands are in another function, so when I run this script all the commands are send to one session.

Code:
Sub Main
	crt.Session.ConnectInTab("/S session1")
	Function1
	crt.Session.ConnectInTab("/S session2")
	Function1
    For nIndex = 1 to crt.GetTabCount
        Set objCurrentTab = crt.GetTab(nIndex)
        objCurrentTab.Activate
        if objCurrentTab.Session.Connected = True Then
        	Function1
        end if
    Next
End Sub

Sub Function1
	crt.Screen.Send "command 1" & vbcr
        crt.Screen.Send "command 2" & vbcr
End Sub

Last edited by jdev; 09-18-2018 at 11:44 AM. Reason: wrap code in [code] blocks to preserve indentation
Reply With Quote
 

Tags
function , multiple , session

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 08:30 PM.