SUSANVV wrote:Is there any way I can create a script, .vnc or whatever to automate logging on. I use the automated logging process to have remote computers log on
solution from [user=12015][/user]
go download autoit, for free, install it, and make a new script.
------SCRIPT------
; this script is the basis for automating sign on to ULTR@VNC
; | SETTING PARAMETERS |
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"
EndIf
;** Set the Do Until Up
Dim $ok
$ok=6
Do
; *** 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")
Else
Exit
EndIf
;Once the program loads Send the Machine Name
ControlFocus("Ultr@VNC Viewer - Connection","","Edit1")
Send($pcname)
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
Else
$case = 2
EndIf
Select
;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
EndIf
EndSelect
Until $ok=7
Exit
-----SCRIPTEND------
Change the particulars to your environment then compile with AutoIT and run the exe.
Enjoy,
Sean