AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DimInactive - Dim all inactive windows

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
skrommel



Joined: 30 Jul 2004
Posts: 178

PostPosted: Mon Jul 18, 2005 1:03 am    Post subject: DimInactive - Dim all inactive windows Reply with quote

Very Happy 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
Back to top
View user's profile Send private message Visit poster's website
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Mon Jul 18, 2005 1:24 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
garry



Joined: 19 Apr 2005
Posts: 1033
Location: switzerland

PostPosted: Mon Jul 18, 2005 8:23 am    Post subject: Reply with quote

had problem with my eyes, had usually a grey or black background
now all the not active windows are dimmed
nice script
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1718

PostPosted: Mon Jul 18, 2005 7:23 pm    Post subject: Reply with quote

that's one neat script here!
_________________
Back to top
View user's profile Send private message
skrommel



Joined: 30 Jul 2004
Posts: 178

PostPosted: Tue Jul 19, 2005 5:00 am    Post subject: Ghoster Reply with quote

Very Happy A much improved version can be found here http://www.autohotkey.com/forum/viewtopic.php?t=4535.

Skrommel
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group