Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 286
john234 Avatar asked Aug 06 '16 00:08

john234


People also ask

How do I use an AutoHotkey window spy?

Meet Window SpyRun your empty script to have the AHK icon appear in the Windows tray. Right-click on it and choose Window Spy from the menu that pops up. Now, whenever you click on any other window, AutoHotkey's Window Spy will present you information about it.

How do I double click in AutoHotkey?

Double click Right mouse button to activate the part of double click code. Click and hold Right mouse button for a moment (more than 200 ms) then release it to activate the the part of single click code. btw, i comment the Send, ^p and Send, {RButton} to make it just focus on the ToolTip. You can change it if you want.

How do I use the left mouse button in AHK?

The left mouse button when used with Send, but the primary mouse button when used with hotkeys. In other words, if the user has swapped the buttons via system settings, LButton:: is physically activated by clicking the right mouse button, but Send {LButton} performs the same as physically clicking the left button.


1 Answers

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.

like image 79
Joe DF Avatar answered Sep 22 '22 17:09

Joe DF