Jump to content
Sign in to follow this  
TXTechie

ControlClick not clicking on button

Recommended Posts

TXTechie
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]")

Else
    MsgBox($MB_SYSTEMMODAL, "Not Found", "Window does not exist")
EndIf
 
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
Name:   
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 <<<<
&Yes
&No
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.

Share this post


Link to post
Share on other sites
TXTechie
ontrolClick($hWnd, "", "[CLASS:Button; INSTANCE:2]")

 

Hi JohnOne,

I tried that and a few other differences with no change. Just to be sure, I tried your suggestion (leaving out the "TEXT:&No" parameter) and it still doesn't click on the button.

Share this post


Link to post
Share on other sites
TXTechie

No, the following didn't work either:

ControlClick($hWnd, "", "[ID:7]")

Share this post


Link to post
Share on other sites
TXTechie

I'm testing on Windows 8.1 Pro (64-bit), I just saw from >this recent post that someone else is having problems with ControlClick on Win8.1. I wanted to use ControlClick because, from other forum posts I learned that it's more robust/reliable.

So, I just tried the following with no effect:

Send("!n")

What else should I use instead?

Share this post


Link to post
Share on other sites
somdcomputerguy

Try ShellExecute instead of ShellExecuteWait.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
TXTechie

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.

Share this post


Link to post
Share on other sites
somdcomputerguy

I didn't think it would help, as you stated the MsgBox functions were executing, but I thought I would throw it in anyway. Good luck!


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • Yirrlaar
      By Yirrlaar
      #Include <WinAPI.au3> local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]"))) ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary") When I am running this script it just gives me a ConsoleWrite output of "0x001D04A8"
      When using "AutoIT v3 Window Info" all the info I need for the ControlClick is there and displayed perfectly as if I typed it in normally.
      Upon click the button it should be clicking it, I see the following inn the console window:
      If I replace the $ClassName with the actual ClassName of "WindowsForms10.BUTTON.app.0.3296db7_r14_ad1" it works just fine, any ideas???
    • Tats
      By Tats
      Hi everyone,
      I have a problem with ControlClick function. It doesn't work no matter how I tried all the possible combination of the parameters.
      Below is the scripts of possible parameter combination:
      ;ControlClick("title","text","controlID ","button","clicks","x","y") ;title= Title, Class, Handle ;controlID= Class, ClassNN, Instance ;Title here is empty when I check it with AutoIt Info ControlClick("", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Class of the window ControlClick("[ScreenKeyboard::SKFrame]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Handle of the window ControlClick("[0x000907A0]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[INSTANCE:18]", "left", "1", "230","890") Am I coding it correctly?
      Thanks
    • MaximusCZ
      By MaximusCZ
      Hello, and apologies if this have been discussed before, but I googled and couldnt find anything relevant.
      I have a problem where I try to send a control clink into to a window. 
      Part of window I try to send clicks to looks like this . The black border is showing when I mouse over it Au3Info, I get following information:

      I am testing its interaction with code

      The result I get is that it makes control clicks trough first line, opens and closes menus, as expected.
      When It gets to second line, it does not click a single icon. I can tell that coords are correct as the dropdown menus (No view active) gets focused(altough not rolled out). Same behaviour happens if roughly 40<y<60, so I know I am hitting good height. You can look at how it behaves here: output.webm 
      Dropdown 1 focuses at around 8 sec mark, and 13 sec mark it changes to second dropdown, defocusing first one, seemingly not registering any clinks inbetween.
       
      Have you ever encountered similar behaviour? I need to click the Key button, first on second line, with controlclick (or any other way not hijacking the mouse). I cant trigger that button by keyboard and There is no other control having control over it.
      Help
       
    • Skysnake
      By Skysnake
      I need to automate a specific GUI from a legacy system written in C.
      The spy tool gives me this

      I use this code
      Local $swintit = WinGetTitle("[active]") ConsoleWrite("active Window " & $swintit & @CRLF) If $swintit = "FILES NOTES" Then ; If $swintit = "FILES NOTES" Then ; got Window, now atomate ConsoleWrite("got Window " & @CRLF) ; now focus, then click :) ;EditPaste ;ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(404, $GUI_Focus) ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(401, $GUI_Focus) ControlClick("FILES NOTES", "", 401, $acno) ; click okay EndIf ; If $swintit = "FILES NOTES" Then The idea is to paste the acno value into the edit box, then click an Okay button.
      I get a console write that the active Window is as expected, but my loop completes without ever writing anything into the GUI.
      I also tried the control ID as text "404" - same result
      What am I missing?
      Skysnake
       
    • JNutt
      By JNutt
       

       
       
      I'm trying to use mouseclick in a panel above.  I want to click on a list item, such as 'Estimated'.  (I've given up on trying to use control click for this).  I'm using window info coordinates from 'Control' tab.

      ; click 'Columns' WinActivate("Innovaya Studio with Sage (Archtectural 2017_V1.invx") MouseClick("primary", 292, 88, 1, 1) WinActivate("Select Browsing Properties") Sleep(1000) MouseClick("primary", 27, 70, 0,0) Sleep(2000) Send("{TAB}{TAB}{TAB}{TAB}{TAB}") Sleep(1000) Send("{ENTER}") ControlClick( But when I used the code Autoit doesn't click where the coordinates are.  In the scipts it is the second MouseClick that won't work.  Any ideas?
×