Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoIt - ControlClick does not work

Tags:

autoit

I dont know how to make this working or I am missing something - maybe in #include ? at this point I have:

#RequireAdmin
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>

;vcdredist
Run($sDrivers & "\vcredist_x86.exe")
WinWaitActive("vcredist_x86")
;ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[CLASS:Button; INSTANCE:3]")
ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[ID:105]")

I've checked with AutoIt v3 WIndow Control and arguments inside ControlClick are correct

none of last two lines make AutoIt select desired option. Any help very much appreciated.

like image 984
Msmkt Avatar asked Jun 24 '26 04:06

Msmkt


1 Answers

WinWaitActive()

Probably Isn't the thing you're looking for, as it waits for the window to be active for the code to be ran. WinActivate() activates the window. If you want the code to run when you activate the window, then WinWaitActive() will do.

Also you can avoid having the title in the ControlClick by doing this.

$hWnd = WinWait("vcredist_x86")
WinWaitActive("vcredist_x86")
ControlClick($hWnd, "", "[CLASS FROM AUTOITINFO]", "Left", 1)

Use the Autoit Window Info tool to find the classes if you aren't using it already. (https://www.autoitscript.com/autoit3/docs/intro/au3spy.htm)

If ControlClick still doesn't work, then you can try using

MouseClick("Left", x, y)

X, Y are the coordinates.

like image 154
Dragg Avatar answered Jun 26 '26 17:06

Dragg