# $language = "VBScript" # $interface = "1.0" ' SendToAll.vbs Sub Main() if Not crt.Session.Connected then szSession = crt.Dialog.Prompt("Enter session:", "", "", False) if szSession = "" then exit sub crt.Session.ConnectInTab("/S " & szSession) crt.Session.ConnectInTab("/S " & szSession) crt.Session.ConnectInTab("/S " & szSession) end if ' Find out what should be sent to all tabs szCommand = crt.Dialog.Prompt("Enter command to be sent to all tabs:", _ "Send To All Connected Tabs", "ls", False) if szCommand = "" then exit sub If crt.Dialog.MessageBox(_ "Are you sure you want to send the following command to " & _ "__ALL__ tabs?" & vbcrlf & vbcrlf & szCommand, _ "Send Command To All Tabs - Confirm", _ vbyesno) <> vbyes then exit sub ' Connect to each tab in order from left to right, issue a command, and ' then disconnect... For nIndex = 1 to crt.GetTabCount Set objCurrentTab = crt.GetTab(nIndex) objCurrentTab.Activate if objCurrentTab.Session.Connected = True then crt.Sleep 500 objCurrentTab.Screen.Send szCommand & vbcr crt.Sleep 1000 end if Next MsgBox "The following command was sent to all connected tabs:" & vbcrlf & _ vbcrlf & szCommand End Sub