Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VBS to launch web based VNC Viewer

Status
Not open for further replies.

dseaver

IS-IT--Management
Jul 13, 2006
467
I am trying to make a vbs that opens IE, connects to a w2k machine with realvnc at the address somehost:5800, connect to the vnc server, send ctrl-alt-del via the F8 keypress menu, and populate the logon username with the xp pc's username, here is what I have so far, along with where it stops working:
Code:
 set IE=Wscript.CreateObject("InternetExplorer.Application","objIE_")
    IE.Navigate("[URL unfurl="true"]http://somehost:5800")[/URL]
    IE.visible = True
	WScript.Sleep(10000)
	Set WshShell = WScript.CreateObject("WScript.Shell")
	

	WshShell.SendKeys "{ENTER}"
	WScript.Sleep(5000)
	WshShell.SendKeys "{F8}"<<Does not bring up the f8 menu
	WshShell.Sendkeys"{DOWN}"
	WshShell.Sendkeys"{DOWN}"
	WshShell.Sendkeys"{DOWN}"
	WshShell.Sendkeys"{DOWN}"
	WshShell.Sendkeys"{ENTER}"
	

	Wscript.Sleep(1000)
	Set WSHNetwork = CreateObject("WScript.Network")
	
	WshShell.SendKeys WSHNetwork.username
I am limited to using a script and IE, otherwise I would use a vnc viewer for this, but that is out of the question
 
I got sendkeys ^%+{del} to work in a different window, but it doesnt work in the scop of this script. here is the updated script
Code:
 set IE=Wscript.CreateObject("InternetExplorer.Application","objIE_")
    IE.Navigate("[URL unfurl="true"]http://somehost:5800")[/URL]
    IE.visible = True
	WScript.Sleep(10000)
	Set WshShell = WScript.CreateObject("WScript.Shell")
	

	WshShell.SendKeys "{ENTER}"
	WScript.Sleep(500)

	WshShell.SendKeys "%^+{DEL}"

	

	Wscript.Sleep(1000)
	Set WSHNetwork = CreateObject("WScript.Network")
	
	WshShell.SendKeys WSHNetwork.username
 
Also, If there is a mouse click on the java before WshShell.SendKeys "%^+{DEL}", the rest of the script works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top