Trigger An Action When a Non-AHK Button Is Interacted With

Get help with using AutoHotkey and its commands and hotkeys
MaxAstro
Posts: 378
Joined: 05 Oct 2016, 13:00

Trigger An Action When a Non-AHK Button Is Interacted With

14 Jul 2017, 17:10

I think I have a basic idea of how to do this, maybe, but not a foolproof one - which is kinda what I need.

I have a program, and in that program is a button. Identifying the button's class or even hwnd if needed is easy. What I want to do is trigger a certain action any time that button is pressed - no matter HOW it is pressed. Left click, Alt + underlined letter, tab to it and press Enter, or even triggered with ControlClick, ideally. Any time that button gets pushed, I want my script to trigger.

The only way I can think to do this is to hotkey LButton and check every mouse click to see if the button was clicked on, then do the same thing with Alt+M and Enter. I'm not sure how reliable that would be, or how likely it would be to mess other things up. Is there a cleaner solution?
BoBo
Posts: 1427
Joined: 13 May 2014, 17:15

Re: Trigger An Action When a Non-AHK Button Is Interacted With

15 Jul 2017, 01:06

You could check if the button is changing its appearance (looking flat if pushed). Probably OnMessage would be of help?
MaxAstro
Posts: 378
Joined: 05 Oct 2016, 13:00

Re: Trigger An Action When a Non-AHK Button Is Interacted With

17 Jul 2017, 15:35

OnMessage looked promising, but it only monitors messages received by the script; I can't intercept messages to other programs. Sadly the button doesn't change appearance if it is activated with alt + underlined letter...

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, chngrcn, Odlanir, Rohwedder, vsub and 74 guests