Hello,
I'm new here and to AutoIT, but not to programming/scripting in general. This is my first attempt at an AutoIT script. The purpose of the script is to install TightVNC server on the target machine, which could be any flavor of Windows from XP forward. Development is happening on Windows 7 Pro. I've managed to get past a couple hurdles, namely the open file warning, and interacting with a systreeview control to turn off the viewer portion of the install. I'm stuck in two places. One is UAC. During the actual install, Windows pops up the usual "Do you want to allow ..." message, and the install stops until you acknowledge it. I think I've seen it refered to as a secure desktop. I've tried the #Requireadmin directive, but that didn't have any effect. The other pace I'm stuck is just before the install completes, an always-on-top window opens for setting up passwords for the VNC server. What actually needs to happen is I need to click on two different radio buttons to indicate I don't want to use passwords, and then dismiss the window. I don't seem to be able to interact with this window at all. AU3Info seems to be able to identify this window and the controls on it, but that hasn't helped. There are 6 radio buttons and 4 entry fields on this window, plus a visible button at the bottom. 3 of the radio buttons and two of the entry fields are grouped together in what I would call a frames. A box comprised of a slightly sunken line with a title in the top left. AU3Info identifies this as a button. It also identifies each of the radio buttons as a button. I've tried ControlClick, ControlComand, and I've tried sending keystrokes to the windows with ControlSend. None of these seems to have any effect whatsoever. Also, the one thing that should work, which is clicking the button at the bottom of the window, does not. It's like even though I've used the _WinWaitActivate function to wait for and activate the window, the window is not truly active. It seems to actually "fall through" those four lines of code. As a debug measure, I put in a long Sleep, and the script gets to that point, or at least it seems to. Code included below. The problem area starts 4 line before the Sleep(60000) near the bottom of the code. I actually suspect that the two issues may be related, both being in a secure desktop, although the behavior of this password window isn't quite the same as UAC itself.
Any and all help/comments appreciated.
----<CODE>----
#include <winapi.au3>
EnvSet("SEE_MASK_NOZONECHECKS","1")
ShellExecute('C:\temp\tightvnc-2.6.4-setup-32bit.msi')
_WinWaitActivate("TightVNC Setup","")
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","License Agreement")
ControlClick("TightVNC Setup","",911)
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","Choose Setup Type")
ControlClick("TightVNC Setup","",954)
_WinWaitActivate("TightVNC Setup","Server and Viewer")
ControlClick("TightVNC Setup","",970,"",1,100,42)
ControlSend ('TightVNC Setup',"",970,'{End}{Space}')
Sleep(250)
ControlSend ('TightVNC Setup',"",970,'{Down 4}{Enter}')
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","Select Additional Tasks")
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","Ready to install")
ControlClick("TightVNC Setup","",879)
_WinWaitActivate("TightVNC Server: Set Passwords","Please")
ControlCommand("TightVNC Server: Set Passwords","Please","[CLASS:Button; INSTANCE:3]","Check","")
ControlCommand("TightVNC Server: Set Passwords","Please","[CLASS:Button; INSTANCE:7]","Check","")
ControlClick("TightVNC Server: Set Passwords","Please","[CLASS:Button; INSTANCE:9]")
Sleep(60000)
_WinWaitActivate("TightVNC Setup","")
ControlClick("TightVNC Setup","",817)
EnvSet("SEE_MASK_NOZONECHECKS","0")
Exit
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc
I'm new here and to AutoIT, but not to programming/scripting in general. This is my first attempt at an AutoIT script. The purpose of the script is to install TightVNC server on the target machine, which could be any flavor of Windows from XP forward. Development is happening on Windows 7 Pro. I've managed to get past a couple hurdles, namely the open file warning, and interacting with a systreeview control to turn off the viewer portion of the install. I'm stuck in two places. One is UAC. During the actual install, Windows pops up the usual "Do you want to allow ..." message, and the install stops until you acknowledge it. I think I've seen it refered to as a secure desktop. I've tried the #Requireadmin directive, but that didn't have any effect. The other pace I'm stuck is just before the install completes, an always-on-top window opens for setting up passwords for the VNC server. What actually needs to happen is I need to click on two different radio buttons to indicate I don't want to use passwords, and then dismiss the window. I don't seem to be able to interact with this window at all. AU3Info seems to be able to identify this window and the controls on it, but that hasn't helped. There are 6 radio buttons and 4 entry fields on this window, plus a visible button at the bottom. 3 of the radio buttons and two of the entry fields are grouped together in what I would call a frames. A box comprised of a slightly sunken line with a title in the top left. AU3Info identifies this as a button. It also identifies each of the radio buttons as a button. I've tried ControlClick, ControlComand, and I've tried sending keystrokes to the windows with ControlSend. None of these seems to have any effect whatsoever. Also, the one thing that should work, which is clicking the button at the bottom of the window, does not. It's like even though I've used the _WinWaitActivate function to wait for and activate the window, the window is not truly active. It seems to actually "fall through" those four lines of code. As a debug measure, I put in a long Sleep, and the script gets to that point, or at least it seems to. Code included below. The problem area starts 4 line before the Sleep(60000) near the bottom of the code. I actually suspect that the two issues may be related, both being in a secure desktop, although the behavior of this password window isn't quite the same as UAC itself.
Any and all help/comments appreciated.
----<CODE>----
#include <winapi.au3>
EnvSet("SEE_MASK_NOZONECHECKS","1")
ShellExecute('C:\temp\tightvnc-2.6.4-setup-32bit.msi')
_WinWaitActivate("TightVNC Setup","")
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","License Agreement")
ControlClick("TightVNC Setup","",911)
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","Choose Setup Type")
ControlClick("TightVNC Setup","",954)
_WinWaitActivate("TightVNC Setup","Server and Viewer")
ControlClick("TightVNC Setup","",970,"",1,100,42)
ControlSend ('TightVNC Setup',"",970,'{End}{Space}')
Sleep(250)
ControlSend ('TightVNC Setup',"",970,'{Down 4}{Enter}')
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","Select Additional Tasks")
ControlClick("TightVNC Setup","",846)
_WinWaitActivate("TightVNC Setup","Ready to install")
ControlClick("TightVNC Setup","",879)
_WinWaitActivate("TightVNC Server: Set Passwords","Please")
ControlCommand("TightVNC Server: Set Passwords","Please","[CLASS:Button; INSTANCE:3]","Check","")
ControlCommand("TightVNC Server: Set Passwords","Please","[CLASS:Button; INSTANCE:7]","Check","")
ControlClick("TightVNC Server: Set Passwords","Please","[CLASS:Button; INSTANCE:9]")
Sleep(60000)
_WinWaitActivate("TightVNC Setup","")
ControlClick("TightVNC Setup","",817)
EnvSet("SEE_MASK_NOZONECHECKS","0")
Exit
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc