usage:
Press Alt + F1 to dim selected windows
Press Alt + F2 to destroy all overlay boxes
Code: Select all
; =================================================================================================================================
; Name: Dimmer box
; Description: Dim selected windows with an overlay box
; credits: Speedmaster, Skwire
; Topic: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=78587
; Sript version: 1.0
; AHK Version: 1.1.24.03 (A32/U32/U64)
; Tested on: Win 7
; shortcuts:: !F1 update all boxes or add a new one
; !F2 destroy all boxes
#SingleInstance force
!F1::
winid:=""
WinGetPos, X, Y, W, H, A
WinGet, winid,, A
if instr(idlist, winid) {
for k, v in strsplit(idlist, "_") {
if (v) {
WinGetPos, X, Y, W, H, % "ahk_id " . v
if w
Gui, dim_%k% : Show, % "x" . x . "y" . y . "w" . w . "h" . h, Overlay
else
Gui, dim_%k% : Destroy
}
}
return
}
if instr(excludelist, winid)
return
if !winid
return
dimcount++
if winid
idlist .= winid "_"
; thx Skwire
Gui, dim_%dimcount% : +Toolwindow -Caption +Lastfound +AlwaysOnTop
Gui, dim_%dimcount% : Color, black ; Change overlay colour here.
Gui, dim_%dimcount% : Show, % "x" . x . "y" . y . "w" . w . "h" . h, Overlay
GUI_ID := WinExist()
excludelist .= gui_id
WinSet, Transparent, 100 , % "ahk_id " . GUI_ID ; Change the numerical value for opaqueness amount.
WinSet, ExStyle , +0x00000020, % "ahk_id " . GUI_ID ; Leave this value alone
Return
!f2::
loop, % dimcount
Gui, dim_%a_index% : Destroy
idlist:=excludelist:=dimcount:=winid:=""
return
esc::exitapp