When writing a script I often need to look at the Help page. Unfortunately, the interesting part of it is always the one covered by the edit window. I can AltTab between the applications, but a mouse movement could be enough to make my edit window transparent. Moving back the mouse cursor restores the edit window. This is also useful as a replacement of a Boss (or Panic) Button: if your boss walks in your cubicle you don't even have to click on anything or hit a key, a quiet mouse movement hides the window you don't want him to see. It was suggested
here. (In this case minimizing the window, instead of making it transparent could be better.)
This little utility is activated by LeftWindows-LeftMouseClick (LWin & LButton). The window under the mouse cursor is marked as hide-and-seek. After that, if the mouse cursor leaves the window or gets to its border (useful for maximized windows), the window becomes transparent. When the cursor returns to the inside of the hidden window, it becomes opaque again. This behavior remains active and automatically adapts to moved or resized windows, too. Pressing the HotKey: LWin & LButton again de-activates the script and removes the transparency effect from the hide-and-seek window, if it still exists. If the script exits for whatever reason (error or manual exit through the tray icon), the opacity gets restored, so you won't be left with an invisible window.
If the mouse cursor is on the TaskBar at activation, you get a similar behavior as its Auto Hide option. Pressing the HotKey again, regardless of the mouse position, restores the normal taskbar.
Code:
OnExit Cleanup
LWin & LButton::
IfEqual HideWindow,, { ; Not set => Activate now
MouseGetPos,,,HideWindow ; Window ID under mouse
SetTimer TransWindow, 150
}
Else { ; Already set => Stop, Restore
SetTimer TransWindow, Off
IfWinNotExist ahk_id %HideWindow%, Return
WinActivate ahk_id %HideWindow%
WinSet Transparent, 255, ahk_id %HideWindow%
HideWindow =
}
Return
TransWindow:
CoordMode Mouse, Relative
MouseGetPos X, Y, Window
WinGetPos,,,X1, Y1, ahk_id %HideWindow%
If ( Window = HideWindow && X > 4 && Y > 4 && X < X1-5 && Y < Y1 )
WinSet Transparent, 255, ahk_id %HideWindow%
Else WinSet Transparent, 1, ahk_id %HideWindow%
Return
Cleanup:
IfWinExist ahk_id %HideWindow%
{
WinActivate ahk_id %HideWindow%
WinSet Transparent, 255, ahk_id %HideWindow%
}
ExitApp