Jump to content


Photo

DimInactive - Dim all inactive windows


  • Please log in to reply
4 replies to this topic

#1 skrommel

skrommel
  • Members
  • 193 posts

Posted 18 July 2005 - 12:03 AM

:D 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


;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


#2 polyethene

polyethene

    Administrator

  • Administrators
  • 5473 posts

Posted 18 July 2005 - 12:24 AM

That's a really good idea, nice script.

Moving windows is laggy/slow and tooltips sometimes don't fully show. Other than that, it's great! Thanks.

#3 garry

garry
  • Members
  • 2596 posts

Posted 18 July 2005 - 07:23 AM

had problem with my eyes, had usually a grey or black background
now all the not active windows are dimmed
nice script

#4 Rajat

Rajat
  • Members
  • 1886 posts

Posted 18 July 2005 - 06:23 PM

that's one neat script here!

#5 skrommel

skrommel
  • Members
  • 193 posts

Posted 19 July 2005 - 04:00 AM

:D A much improved version can be found here http://www.autohotke...opic.php?t=4535.

Skrommel