Detect what app the mouse pointer is hovering on.

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
LogicNg
Posts: 20
Joined: 17 Mar 2021, 05:39

Detect what app the mouse pointer is hovering on.

Post by LogicNg » 11 Jun 2021, 05:56

Whenever the mouse pointer hovers on a specific app, I want it to execute some code without the need to click the app (i.e. without using #IfWinActivate), does anyone know how to do it?

User avatar
boiler
Posts: 17105
Joined: 21 Dec 2014, 02:44

Re: Detect what app the mouse pointer is hovering on.

Post by boiler » 11 Jun 2021, 09:16

You can use SetTimer and MouseGetPos to monitor which window the mouse is over and for how long, including whether its position is changing (i.e., whether it’s hovering). The documentation links are to AHK v1 because I suspect you are not really using v2 (you posted in the section for v2, which is in alpha release).

LogicNg
Posts: 20
Joined: 17 Mar 2021, 05:39

Re: Detect what app the mouse pointer is hovering on.

Post by LogicNg » 12 Jun 2021, 10:22

It works!!!

Post Reply

Return to “Ask for Help (v2)”