Le script AutoIt:
; Read password from depanvnc.ini file.
$password = IniRead("depanvnc.ini", "depanvnc", "password", "")
; Example: depanvnc.ini file:
;[depanvnc]
;password=mysecret
; If there is not password, abort.
if $password=="" Then
MsgBox (16, "Erreur", "Il manque le fichier depanvnc.ini.")
Exit(1)
EndIf
; Prevent user from doing stupid things
BlockInput(1)
; Show progress dialog
ProgressOn("Lancement de TightVNC, patientez...","Lancement de TightVNC, patientez...")
ProgressSet(5)
; Close VNC server if it's alreay running:
If ProcessExists("winvnc.exe") Then
ProcessClose("winvnc.exe")
ProcessWaitClose("winvnc.exe")
Sleep(1000)
EndIf
; Remove previous WinVNC settings from registry
RegDelete("HKEY_CURRENT_USER\SOFTWARE\ORL")
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\ORL")
; Start WinVNC:
Run("winvnc.exe")
ProgressSet(15)
AutoItSetOption("WinTitleMatchMode", 1) ; Exact title from beginning
WinWait("WinVNC: Current User Properties")
WinActivate("WinVNC: Current User Properties")
WinWaitActive("WinVNC: Current User Properties")
ProgressSet(50)
; Set the password:
Send($password) ; Set password
Send("{TAB}")
Send($password)
ProgressSet(75)
; Advanced configuration...
Send("!v")
; Ask confirmation if someone tries to connect:
WinWaitActive("WinVNC: Current User Advanced Properties")
ControlClick("WinVNC: Current User Advanced Properties","","Query console on incoming connections")
Send("!o") ; Click OK
Send("{ENTER}") ; Click OK on the main configuration Window.
ProgressSet(100)
ProgressOff()
BlockInput(0)
; Display user's IP address:
$ip = @IPAddress1
If $ip <> "0.0.0.0" Then
If $ip <> "127.0.0.1" Then
MsgBox (64, "Votre adresse IP", "Votre adresse IP est "&$ip)
EndIf
EndIf
$ip = @IPAddress2
If $ip <> "0.0.0.0" Then
If $ip <> "127.0.0.1" Then
MsgBox (64, "Votre adresse IP", "Votre adresse IP est "&$ip)
EndIf
EndIf
$ip = @IPAddress3
If $ip <> "0.0.0.0" Then
If $ip <> "127.0.0.1" Then
MsgBox (64, "Votre adresse IP", "Votre adresse IP est "&$ip)
EndIf
EndIf
$ip = @IPAddress4
If $ip <> "0.0.0.0" Then
If $ip <> "127.0.0.1" Then
MsgBox (64, "Votre adresse IP", "Votre adresse IP est "&$ip)
EndIf
EndIf
; Wait for the end of WinVNC to exit.
ProcessWaitClose("winvnc.exe")
; Remove registry settings (including password)
RegDelete("HKEY_CURRENT_USER\SOFTWARE\ORL")
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\ORL")
Exit(0)


