john234
john234

Reputation: 61

How to click a specific button on a window with autohotkey?

The button I want to click is on a not maximized on top window. It's like a tiny window on top of everything else. I want to address a hotkey to its button, for example pressing D and the button is pressed.

Upvotes: 6

Views: 31497

Answers (2)

Thierry Dalon
Thierry Dalon

Reputation: 916

If the button is not accessible by ControlClick you can try to do an ImageSearch or FindText https://www.autohotkey.com/boards/viewtopic.php?f=6&t=17834

Also have a look at the UIAutomation Library

Upvotes: 1

Joe DF
Joe DF

Reputation: 5548

See the AutoHotkey documentation as suggested by @user3419297
https://autohotkey.com/docs/commands/ControlClick.htm

With the window spy, you'll be able to find the control's Name/ID. For example, Button2 or Edit1. Then use ControlClick on that control.

ControlClick, Button2, WindowTitle

Most likely you'll be able to use the button's text too. For example, an "OK" button.

ControlClick, OK, WindowTitle

In both examples given, WindowTitle is where you can put the words that show up in a window's title bar. More can be learned from the documentation.

Upvotes: 7

Related Questions