Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

DimInactive - Dim all inactive windows


  • Please log in to reply
4 replies to this topic
skrommel
  • Members
  • 193 posts
  • Last active: Jun 07 2010 08:30 AM
  • Joined: 30 Jul 2004
: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


polyethene
  • Administrators
  • 5517 posts
  • Last active: Jun 02 2014 02:21 AM
  • Joined: 26 Oct 2012
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.

garry
  • Members
  • 2938 posts
  • Last active: Aug 20 2014 08:43 AM
  • Joined: 19 Apr 2005
had problem with my eyes, had usually a grey or black background
now all the not active windows are dimmed
nice script

Rajat
  • Members
  • 1904 posts
  • Last active: Aug 18 2014 02:25 AM
  • Joined: 28 Mar 2004
that's one neat script here!

skrommel
  • Members
  • 193 posts
  • Last active: Jun 07 2010 08:30 AM
  • Joined: 30 Jul 2004
:D A much improved version can be found here http://www.autohotke...opic.php?t=4535.

Skrommel