skrommel
Joined: 30 Jul 2004 Posts: 178
|
Posted: Mon Jul 18, 2005 1:03 am Post subject: DimInactive - Dim all inactive windows |
|
|
Here's a script to dim all inactive windows giving the active one full attention.
DimInactive creates a black gui with an emtpy image to catch any clicks, sets the transparency, puts it on top and alters the region to cover all the desktop except the active window.
It was asked for in a different forum by jsmallberry, so the idea is not mine.
@Chris: There's a limitation in the WinSet,Region that had me debugging for hours - it doesnt works with negative numbers. A bug or a feature? I can live with the workaround.
Skrommel
| Code: | ;DimInactive
;Dims inactive windows
;Skrommel 2005
Gui,+Owner +AlwaysOnTop -Disabled -SysMenu -Caption
Gui, Color, 000000
Gui,Add,Picture,X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight% gCLICK,
Gui,Show,NoActivate X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight%,WINDOW
WinSet,Transparent,100,WINDOW
LOOP:
Sleep,0
WinGetActiveStats,wint,winw,winh,winx,winy
winw+=winx
winh+=winy
If winx<0
winx=0
If winy<0
winy=0
If wint=
{
winx=0
winy=0
winw=%A_ScreenWidth%
winh=%A_ScreenHeight%
}
WinSet,Region,0-0 %A_ScreenWidth%-0 %A_ScreenWidth%-%A_ScreenHeight% 0-%A_ScreenHeight% 0-0 %winx%-%winy% %winw%-%winy% %winw%-%winh% %winx%-%winh% %winx%-%winy%,WINDOW
WinSet,Top,,WINDOW ; Rem this line to keep the task bar visible
Goto,LOOP
CLICK:
WinSet,Bottom,,WINDOW
CoordMode,Mouse,Screen
MouseGetPos,mousex,mousey,mousewin
MouseClick,Left,%mousex%,%mousey%
MouseClick,Left,%mousex%,%mousey%
WinSet,AlwaysOnTop,On,WINDOW
Return |
Last edited by skrommel on Mon Jul 18, 2005 1:30 am; edited 1 time in total |
|