Jump to content

ControlClick not clicking on button


Recommended Posts

I've been using AutoIt for a few years now, but this is the first time that I've attempted to automate another GUI - in this case, the InstallShield uninstall wizard of the Dell Backup and Recovery software installed on our Win8.1 tablets.
AutoIt successfully launches the uninstall wizard and the MsgBox statements tell me that the window I'm looking for has been found, however it never clicks (via the ControlClick statement) on the "No" button (just for testing right now, I will eventually have it click on the "Yes" button, when put in production).
Based on the help and some forum searches, I've come up with the following script:
#include <MsgBoxConstants.au3>

ShellExecuteWait(@ProgramFilesDir & "\InstallShield Installation Information\{0ED7EE95-6A97-47AA-AD73-152C08A15B04}\setup.exe", "-runfromtemp -l0x0409 -removeonly")

; Wait for up to 45 seconds for the "Dell Backup and Recovery - InstallShield Wizard" window to appear
Local $hWnd = WinWait("[CLASS:#32770]", "Do you want to completely remove the selected application and all of its features?", 45)

; Test if the window exists and display the results
If WinExists($hWnd, "") Then

    MsgBox($MB_SYSTEMMODAL, "Found", "Window exists")

    ; Activate the window
    WinActivate($hWnd, "")

    ; Click the 2nd instance of a "Button" control containing the text "&No"
    ControlClick($hWnd, "", "[CLASS:Button; TEXT:&No; INSTANCE:2]")

    MsgBox($MB_SYSTEMMODAL, "Not Found", "Window does not exist")
Here's the contents of the AU3Info tool:
>>>> Window <<<<
Title:  Dell Backup and Recovery - InstallShield Wizard
Class:  #32770
Position:   399, 294
Size:   487, 145
Style:  0x94C801C5
ExStyle:    0x00010101
Handle: 0x00000000000204BC

>>>> Control <<<<
Class:  Button
Instance:   2
ClassnameNN:    Button2
Advanced (Class):   [CLASS:Button; INSTANCE:2]
ID: 7
Text:   &No
Position:   385, 79
Size:   88, 26
ControlClick Coords:    36, 15
Style:  0x50010000
ExStyle:    0x00000004
Handle: 0x0000000000030494

>>>> Mouse <<<<
Position:   823, 414
Cursor ID:  2
Color:  0xF0F4F9

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Do you want to completely remove the selected application and all of its features?

>>>> Hidden Text <<<<
I'm sure that I'm missing something very basic. Please help me solve this puzzle.
Link to comment
Share on other sites

Try ShellExecute instead of ShellExecuteWait.


That's a good point, somdcomputerguy. However, the initial setup.exe apparently spawns another process because the AutoIt script does get to my MsgBox commands and the script then finishes, even though the InstallShield wizard is still running and being displayed.

Still, I made the change based on your suggestion, as it is more appropriate to for my need - thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...