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 

One Pretty Script AKA Transparatizer

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



Joined: 05 Jun 2007
Posts: 89
Location: USA

PostPosted: Tue Aug 19, 2008 6:15 pm    Post subject: One Pretty Script AKA Transparatizer Reply with quote

This guy isn't complicated, just run it open a ton of windows, cascade and play around with alt tab and moving your mouse over windows.

All it does is make all windows transparent other than the active window. It also partially fades in windows when your mouse moves over it.

Also pressing control + alt + A makes toggles always on top for the window currently under the mouse.

Code:

#persistent

settimer, transman, 100
settimer, partunfade, 100
onexit, exiter
transstart()
return

^!a:: ;***
   mousegetpos,,,win
   wingettitle, title, ahk_id %win%
   winset, AlwaysOnTop,TOGGLE, ahk_id %Win%
   if instr(title, " - Always on top")
      winsettitle, ahk_id %win%,,% substr(title, 1, instr(title, " - Always on top") - 1)
   else winsettitle, ahk_id %win%,,%title% - Always on top
return ;*

transman: ;***
   makemtrans()
return ;*

partunfade: ;***
   makemabittrans()
return ;***

exiter: ;***
winget, allwindows, list
Loop, %allwindows% {
   win := allwindows%A_index%
   wingettitle, tit, ahk_id %win%
   wingetclass, cls, ahk_id %win%
   if a_index = 1
   wingettitle, activetit, A
   if isitlegal(cls) and !(tit = activetit) {
      winset, Transparent, OFF, ahk_id %win%
   }
}
exitapp
return ;*

;fix always on top mover
;fix for active windows that shouldn't change transparency eg (find dialogues)


transstart() {
   loop, 200
   {
      thistime := a_index
      winget, allwindows, list
      Loop, %allwindows% {
         win := allwindows%A_index%
         wingettitle, tit, ahk_id %win%
         wingetclass, cls, ahk_id %win%
         if a_index = 1
            wingettitle, activetit, A
         if isitlegal(cls) and !(tit = activetit)
            winset, Transparent,% 255 - thistime, ahk_id %win%
      }
   }
   oldwin := newwin
}

makemtrans() {
   static oldwin
   winget, newwin,, A
   if !(newwin = oldwin) {
      loop, 200
      {
         if a_index = 1
            wingetclass, cls, ahk_id %oldwin%
         if isitlegal(cls)
            winset, Transparent,% 255 - a_index, ahk_id %oldwin%
         if a_index = 1
            wingetclass, cls2, ahk_id %newwin%
         if isitlegal(cls2)
            winset, Transparent,% 55 + a_index, ahk_id %newwin%
      }
   }
   oldwin := newwin
}

makemabittrans() {
   static oldwin
   mousegetpos,,,newwin
   if !(newwin = oldwin) {
      loop, 150
      {
         if (a_index = 1) {
            wingetclass, cls, ahk_id %oldwin%
            winget,activewin,, A
         }
         if isitlegal(cls) and !(oldwin = activewin)
            winset, Transparent,% 205 - a_index, ahk_id %oldwin%
         if (a_index = 1) {
            wingetclass, cls2, ahk_id %newwin%
            winget,activewin2,, A
         }
         if isitlegal(cls2)  and !(newwin = activewin2)
            winset, Transparent,% 55 + a_index, ahk_id %newwin%
      }
   }
   oldwin := newwin
}

isitlegal(cls) {
   wingettitle, activetit, A
   return !(cls = "Button") and
      !(cls = "Progman") and
      !(cls = "SynTrackCursorWindowClass") and
      !(cls = "Shell_TrayWnd")
}
         



please give feedback for ideas for additional features or bug fixes.

SCREENSHOT


Last edited by philz on Wed Aug 20, 2008 12:32 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
BoBo²
Guest





PostPosted: Tue Aug 19, 2008 6:58 pm    Post subject: Reply with quote

Use png/gif/jpg as format for a screenshot. Bmp isn't of any use if used online. Rolling Eyes
Back to top
BoBo²
Guest





PostPosted: Tue Aug 19, 2008 7:01 pm    Post subject: Reply with quote

Use a less generic subject line/name for your script, like Transparatizer ... Wink
Back to top
Sivvy



Joined: 21 Jul 2008
Posts: 726
Location: Calgary, AB, Canada

PostPosted: Tue Aug 19, 2008 7:57 pm    Post subject: Reply with quote

Actually pretty cool... I found that it kinda did it's fading a little too slowly, so I changed:

Code:
transstart() {
   loop, 40
   {
      thistime := a_index
      winget, allwindows, list
      Loop, %allwindows% {
         win := allwindows%A_index%
         wingettitle, tit, ahk_id %win%
         wingetclass, cls, ahk_id %win%
         if a_index = 1
            wingettitle, activetit, A
         if isitlegal(cls) and !(tit = activetit)
         {
            winset, Transparent,% 255 - (thistime * 5), ahk_id %win%
         }
      }
   }
   oldwin := newwin
}

makemtrans() {
   static oldwin
   winget, newwin,, A
   if !(newwin = oldwin) {
      loop, 40
      {
         if a_index = 1
            wingetclass, cls, ahk_id %oldwin%
         if isitlegal(cls)
            winset, Transparent,% 255 - (a_index * 5), ahk_id %oldwin%
         if a_index = 1
            wingetclass, cls2, ahk_id %newwin%
         if isitlegal(cls2)
            winset, Transparent,% 55 + (a_index * 5), ahk_id %newwin%
      }
   }
   oldwin := newwin
}

makemabittrans() {
   static oldwin
   mousegetpos,,,newwin
   if !(newwin = oldwin) {
      loop, 30
      {
         if (a_index = 1) {
            wingetclass, cls, ahk_id %oldwin%
            winget,activewin,, A
         }
         if isitlegal(cls) and !(oldwin = activewin)
            winset, Transparent,% 205 - (a_index * 5), ahk_id %oldwin%
         if (a_index = 1) {
            wingetclass, cls2, ahk_id %newwin%
            winget,activewin2,, A
         }
         if isitlegal(cls2)  and !(newwin = activewin2)
            winset, Transparent,% 55 + (a_index * 5), ahk_id %newwin%
      }
   }
   oldwin := newwin
}

Decreased the Loop Sizes.
It goes a little quicker... But it seems to sometimes have a problem distinguishing which application is currently the active one. It'll fade all applications, but allow you to type on the transparent active window. Not sure what causes it though.
Back to top
View user's profile Send private message
ultimahwhat
Guest





PostPosted: Wed Sep 03, 2008 2:17 am    Post subject: Reply with quote

this is a pretty nifty script, thanks!

i guess the main problem i've run into is it makes menu in programs transparent, which makes them tough to use. For example, in Firefox, clicking "Bookmarks" gives me a semi-transparent menu, and so forth.

I see that you have space at the end of your script for exclusions? Maybe incorporate some kind of exclusion for menus?
Back to top
Display posts from previous:   
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