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