Created
September 20, 2019 06:48
-
-
Save NigelThorne/2544d2984b968e358cdca256cb15885d to your computer and use it in GitHub Desktop.
Highlight Active window in windows - using AHK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Persistent | |
SetTitleMatchMode, 2 | |
SetTitleMatchMode, Fast | |
SetTimer, DrawRect, 50 | |
border_thickness = 20 | |
HideTime := A_TickCount | |
offset := 0 | |
DrawRect: | |
WinGetTitle, title, A | |
WinGetPos, x, y, w, h, A | |
if (x || x = 0) && title <> "ActiveWindowBoarder" && w>0 && h>0 | |
{ | |
t:= border_thickness | |
ow:= w + t | |
oh:= h + t | |
ox:= x - (0.5 * t) | |
oy:= y - (0.5 * t) | |
iw:= ow - (2 * t) | |
ih:= oh - (2 * t) | |
iwt:= iw + t | |
iht:= ih + t | |
Gui, +Lastfound +AlwaysOnTop +Toolwindow | |
Gui, Color, 00FF00 | |
Gui, -Caption | |
; WinSet, Region, 0-0 300-0 300-300 0-300 0-0 100-100 200-100 200-200 100-200 100-100, ahk_class Notepad | |
WinSet, Region, 0-0 %ow%-0 %ow%-%oh% 0-%oh% 0-0 %t%-%t% %iwt%-%t% %iwt%-%iht% %t%-%iht% %t%-%t% | |
ShouldShow := A_TickCount < HideTime | |
if(title <> "Program Manager" and ShouldShow) | |
{ | |
Gui, Show, w%ow% h%oh% x%ox% y%oy% NoActivate, ActiveWindowBoarder | |
} | |
else | |
{ | |
Gui, Hide | |
} | |
} | |
return | |
~LCtrl:: | |
INPUT, SingleKey, L1 M V T0.15, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}{Pause}{ALT GR} | |
IFNOTEQUAL, ERRORLEVEL, TIMEOUT, RETURN ; A key was pressed while Control was down: do nothing | |
IF GETKEYSTATE("LCtrl") | |
RETURN ; LControl is still down: Do nothing | |
IF A_TIMESINCEPRIORHOTKEY > 0 ; (if there was a hotkey event before) | |
IFLESS, A_TIMESINCEPRIORHOTKEY, 300, RETURN ; This prevents triggering from key repeating | |
HideTime := A_TickCount + 1000 | |
RETURN | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script draws a huge green border around the active window if you double tap the ctrl key.