Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 04-02-2008, 09:00 AM
darkoth darkoth is offline
Registered User
Join Date: Jun 2007
Posts: 29
Need help with sending command to multiple tabs

I'm trying to create a script to send a command to multiple tabs.

In this instance, I'm trying to issue a sudo -s command

If "password:" is found return the password, if "#" is found then continue. I'm new at this and am trying to figure out where I'm going wrong. Thanks!

#$language = "VBScript"
#$interface = "1.0"

crt.Screen.Synchronous = True

Sub Main()

	For nIndex = 1 to crt.GetTabCount
		Set objCurrentTab = crt.GetTab(nIndex)
		if objCurrentTab.Session.Connected = True then
			crt.Sleep 500
			objCurrentTab.Screen.Send "/usr/local/bin/sudo -s" & chr(13)

			Dim result;
			result = objCurrentTab.screen.WaitForString("Password:" , 5)

			if result = "Password:" 
				objCurrentTab.Screen.Send "test123" & chr(13)
			else continue;
			crt.Sleep 1000
		end if

	' turn off synchronous mode for normal input processing
	crt.Screen.Synchronous = False
End Sub
Reply With Quote

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 02:14 AM.