AutoIt: Click an Control without ID

0

this is my very first Question. Im trying since about 2 Hours. I Have to compile an AutoIt Executable which will install Xampp on the Computer. This is what ive done so far:

#RequireAdmin
; Script Start
Opt("WinTitleMatchMode", 4)
run ("xampp-win32-7.1.1-0-VC14-installer.exe")
WinWait ("Datei öffnen - Sicherheitswarnung")
ControlClick( "Datei öffnen - Sicherheitswarnung","A&usführen","Button" )
Sleep ( 5 )
; /\ Windows Security Question /\ (Everything Fine in here)
WinWait ("Question")
WinActivate ("Question")
ControlClick("Question","", "[CLASS:QWidget; INSTANCE:3]") <--- AutoIt just wont hit this Button(Actually a Qwidget)
; /\ XAMPP Anti-Virus Question /\

As you can see im trying to left-click the qwidget, but it just wont do. I tried some Raw Methods, too like just sending an Enter as soon as the windows was Activated but it wouldnt work too.

I would have used an ID or something more precise but the WindowInfo do not get any Button(act. QWidget) ID

Heres the Summary of the Button i want to click:

>>>> Window <<<<
Title:  Question
Class:  QWidget
Position:   1427, 405
Size:   506, 170
Style:  0x96C80000
ExStyle:    0x00000104
Handle: 0x0000000000590476

>>>> Control <<<<
Class:  QWidget
Instance:   3
ClassnameNN:    QWidget3
Name:   
Advanced (Class):   [CLASS:QWidget; INSTANCE:3]
ID: 
Text:   
Position:   170, 107
Size:   77, 26
ControlClick Coords:    35, 17
Style:  0x56000000
ExStyle:    0x00000004
Handle: 0x00000000008225C2

>>>> Mouse <<<<
Position:   1635, 552
Cursor ID:  0
Color:  0xD4D0C8

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
qt_msgbox_buttonbox
qt_msgbox_label
qt_msgboxex_icon_label


>>>> Hidden Text <<<<

I just want to click the button, i thought using the "Advanced(Class)"-Value would help because its an exact Definition, but i doesnt.

PS:I Know this code looks kind of cruel, but my priority is to make a running script(somehow) so im open for probably any idea not including "Alt+F4" or "smashing my computer"

Thanks and Best Regards in Advance!

windows
autoit
asked on Stack Overflow Mar 13, 2017 by Rolski

1 Answer

0

You may have to use a relative coordinate as offset: Example:

ControlClick("Title","","[CLASS:QWidget; INSTANCE:3]", "", 1, 35, 17)

It finds the [CLASS:QWidget; INSTANCE:3] object and clicks the coordinates 35,17 (ControlClick Coords: 35, 17) to click button inside that object.

I have a similar situation. Not the best solution but it works for me. Give it a try.

answered on Stack Overflow Mar 29, 2019 by koxta

User contributions licensed under CC BY-SA 3.0