I've been shaking my head for 2 days without results, ask:
Is it possible in any way to specify that the KeyWait must be valid only if the mouse is over a certain window %var%?
my script, I would like to limit the K press valid only with mouse on window %var%
Code: Select all
loop
{
ifwinactive ahk_group xxx
{
wingettitle, Light, A
WinGetPos, x, y, w, h, A
Gui, +Lastfound +Toolwindow
iw:= w + 24
ih:= h + 24
w:= w + 42
h:= h + 42
x:= x - 2 - border_thickness k
y:= y - 2 - border_thickness
Gui, Color, FFFF00
Gui, -Caption
WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0 %border_thickness%-%border_thickness% %iw%-%border_thickness% %iw%-%ih% %border_thickness%-%ih% %border_thickness%-%border_thickness%
Gui, Show, w%w% h%h% x%x% y%y% Noactivate
KeyWait k, D
Gui, Destroy
Sleep, 50
winwaitnotactive, %Light%
}
}