VNC Starter

Should you have problems with the MS logon plugin, here's the place to look for help or report issues.

VNC Starter

Postby vagabond66 » 2007-06-21 21:15

Hi, Ive been using Ultr@VNC on our networks for since RC18 was out. Just wanted to say that you're doing a great job with this program. We were having some problems with some users needing the domain\user and others not when logging in, so i created the following script with AutoIT 3. Its more advanced than the one on the FAQ and tests and handle's servers finds. Anyway hope people can use it.

; this script is the basis for automating sign on to ULTR@VNC

AutoItSetOption ( "MouseCoordMode", 0)
AutoItSetOption ( "WinTitleMatchMode", 2)
AutoItSetOption ("SendKeyDelay",10)

; ***Getting Mouse buttons correct***
Dim $primary
Dim $secondary
;Determine if user has swapped right and $primary mouse buttons
$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

; It's okay to NOT check the success of the RegRead operation
If $k = 1 Then
$primary = "right"
$secondary = "left"
Else ;normal (also case if could not read registry key)
$primary = "left"
$secondary = "right"
;** Set the Do Until Up
Dim $ok

; *** Set internal loop variables
Dim $pcname,$we,$wintitle,$case,$result,$wt

;** Run the Program and Wait till it starts**
$pcname = InputBox("VNC Starter","Input the name of the machine:",""," M",-1,-1, -1, -1, 120)
IF @error = 0 Then
Run("C:\Program Files\UltraVNC\vncviewer.exe");<----This assumes default installation, change for your environment
WinWait("Ultr@VNC Viewer - Connection")

;Once the program loads Send the Machine Name
ControlFocus("Ultr@VNC Viewer - Connection","","Edit1")
Sleep (800)
ControlFocus("Ultr@VNC Viewer - Connection","Connect","Button1")
ControlClick("Ultr@VNC Viewer - Connection","Connect","Button1")

;Wait for machine to come back for authentication or failure
Winwait ("Ultr@VNC","",30) ;<----- change # here for longer or shorter timeouts
$wintitle = WinGetTitle("Ultr@VNC")
;MsgBox (1, "Error", "Wintitle is "& $wintitle)

$wt = String($wintitle)

$result = StringInStr($wt,"I",1,1)
;MsgBox (1, "Error", "Case is "& $result)
If $result = 11 Then
$case = 1
$case = 2

;Case1 Cant find server
Case $case = 1
WinActivate("Ultr@VNC Info")
ControlFocus("Ultr@VNC Info","OK","Button1")
ControlClick("Ultr@VNC Info","OK","Button1")
$ok = MsgBox (52, "Error", "The machine could not be found. Would you like to try another machine?")
;Case2 Server Found ready for authentication
Case $case = 2
WinActivate("Ultr@VNC Authentication")
$we = WinExists("Ultr@VNC Authentication")
If $we = 1 Then
WinActivate("Ultr@VNC Authentication")
ControlFocus("Ultr@VNC Authentication","","Edit1")
Send("domain\username");<------Edit you domain and username here
ControlFocus("Ultr@VNC Authentication","","Edit2")
Send("password")<----- Edit your password here
ControlClick("Ultr@VNC Authentication","Log On","Button1", $primary, 1)
If WinWaitActive ($pcname,"",30)= 1 Then Exit


Until $ok=7


Change the particulars to your environment then compile with AutoIT and run the exe.

Moderated by redge at 2007-06-21 21:19:
added sticky and moved to MS Logon
Last edited by vagabond66 on 2007-08-11 23:39, edited 2 times in total.
Posts: 1
Joined: 2007-06-21 20:30

Return to MS logon plugin

Who is online

Users browsing this forum: No registered users and 2 guests