Gui on Active Window without SetTimer, wait command, multiple Gui possible

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
teosc
Posts: 54
Joined: 17 Jun 2017, 04:56

Gui on Active Window without SetTimer, wait command, multiple Gui possible

13 Jan 2018, 06:08

Hi guys, I need your help.
I have the following script that highlights the active window (I will use notepad class for the example):

Code: Select all

SetTimer, DrawRect, 50
border_thickness = 20
border_color = FFFF00
GroupAdd, XXX, ahk_class Notepad

DrawRect:
MouseGetPos,,, mousehwnd
if (mousehwnd = WinExist("A")) {
   Gui, Destroy
   return
}
ifwinactive ahk_group XXX
{
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 
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
Return
}
Now the gui is hidden when I have the mouse over the active window, and it is recreated as soon as I remove the mouse from the active window.

What I'm trying to do is this:
1. Gui hidden when I have the mouse over the active window, and gui definitely destroyed when any command is sent (from keyboard, mouse, Send etc.) to the active window
2. Possibility of multiple gui, which are not destroyed until any command is sent to the specific window, then if software first activate window A, then B, then C the gui remains active on for each window and each window's gui waits for my command.

I thought about eliminating "SetTimer" and introducing "Goto" and "winwaitnotactive" %windowID%"
Should I use some ddlcall function?
I have done several tests without results, can you give me a hand?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Google [Bot], mikeyww, roysubs and 169 guests