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 

Fade Switch Unminimized Windows

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



Joined: 27 Mar 2008
Posts: 150
Location: USA

PostPosted: Tue Apr 08, 2008 4:28 am    Post subject: Fade Switch Unminimized Windows Reply with quote

This script allows you to switch between open windows somewhat similar to ^!Esc, but it fades the window in and out (looks cool) and only affects windows that aren't minimized. (really handy)

You really have to try it to see what it does. I have it set up to activate when you're holding the MButton down and you Wheel Up or Down.

Code:
;Auto-Exec:
#SingleInstance Force
DetectHiddenWindows Off
SetTitleMatchMode RegEx

;Other:
;*** ---<<<Move Front Window to Back>>---
#IfWinActive
MButton & WheelUp::
   WinGet, WinList, List, .+ ,, Start Menu|Program Manager
   WinCount := 0
   Loop, %WinList%
   {
      WinID := WinList%A_Index%
      WinGet, WindowMin, MinMax, ahk_id %WinID%
      If ( WindowMin = -1 ) ;Cancel if it's minimized and go to the next loop
         Continue
      WinCount++ ;add 1 to wincount
      WindowArray%WinCount% := WinID
   }
   WindowArray := WinCount
   MouseGetPos,,, MouseID
   SleepTime := 0 ;If your computer fades the window too fast for you, add to this. (lucky you :P)
   WinGet, WindowTrans, Transparent, ahk_id %MouseID% ;Finds the current transparency for setting it back later
   ActivateID := ( WindowArray1 = MouseID ) ? WindowArray2 : WindowArray1
   loop, 5 ;Fade the chosen window out
   {
      NumLoop1 := A_Index*(-45)+255
      WinSet, Transparent, %NumLoop1% , ahk_id %MouseID%
      Sleep, %SleepTime%
   }
   WinSet, Bottom,, ahk_id %MouseID% ;send the chosen window to the bottom
   Sleep, 10
   WinActivate, ahk_id %ActivateID% ;activate the next window
   loop, 5 ;fade the chosen window back in
   {
      NumLoop2 := A_Index*51
      WinSet, Transparent, %NumLoop2% , ahk_id %MouseID%
      Sleep %SleepTime%
   }
   if WindowTrans NOT between 0 and 240
      WinSet, Transparent, OFF, ahk_id %MouseID% ; turn off transparency if it's close to opaque, so the system runs faster
   else
      Winset, Transparent, %WindowTrans%, ahk_id %MouseID% ; or set the transparency back to what it originally was
return
;*
;*** ---<<<Move Back Window to Front>>>---
#IfWinActive
MButton & WheelDown::
   WinGet, WinList, List, .+ ,, Start Menu|Program Manager
   WinCount := 0
   Loop, %WinList%
   {
      WinID := WinList%A_Index%
      WinGet, WindowMin, MinMax, ahk_id %WinID%
      If ( WindowMin = -1 )
         Continue
      WinCount++
      WindowArray%WinCount% := WinID
   }
   WindowArray := WinCount
   BottomID := WindowArray%WindowArray%
   SleepTime := 0
   WinGet, WindowTrans, Transparent, ahk_id %BottomID%
   loop, 3
   {
      NumLoop1 := A_Index*(-80)+255
      WinSet, Transparent, %NumLoop1% , ahk_id %BottomID%
      Sleep %SleepTime%
   }
   WinActivate, ahk_id %BottomID%
   loop, 5
   {
      NumLoop2 := A_Index*51
      WinSet, Transparent, %NumLoop2% , ahk_id %BottomID%
      Sleep %SleepTime%
   }
   if WindowTrans NOT between 0 and 249
      WinSet, Transparent, OFF, ahk_id %BottomID%
   else
      Winset, Transparent, %WindowTrans%, %BottomID%
return
;*
;*


I can't think of any good names for it. "Transparent Switcher"?? That sucks worse than what it is now. You've tried it, what do you think would be a good name for it? Question Thanks for looking, hope it does some good!
_________________


Last edited by infogulch on Tue Apr 08, 2008 5:08 am; edited 1 time in total
Back to top
View user's profile Send private message
System Monitor



Joined: 09 Mar 2007
Posts: 393
Location: Unknown

PostPosted: Tue Apr 08, 2008 4:34 am    Post subject: Reply with quote

Wow! That is so cool Very Happy
Nice job infogulch
_________________
Back to top
View user's profile Send private message Visit poster's website
pockinator



Joined: 06 Dec 2007
Posts: 33

PostPosted: Sat Apr 12, 2008 5:15 am    Post subject: Reply with quote

Very cool, infogulch!

Maybe you could call it SwitchFader? I know, I know, not very good. But you asked for suggestions and that's all I could come up with so far. Wink

When I first tested it out, I had no idea what you were referring to about fading and transparency. I then took a look at the code...
Code:
SleepTime := 0 ;If your computer fades the window too fast for you, add to this. (lucky you :P)

I had to change it to 10 to notice the fade. Very Happy

Thanks for posting this!
Back to top
View user's profile Send private message
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