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 

Transparent windows
Goto page Previous  1, 2
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ST
Guest





PostPosted: Thu Apr 20, 2006 9:08 am    Post subject: here goes mine Reply with quote

numberpad / set it to opaque, * set it to more & more transparent (beginning from 200/255). (i used + & -, but sometimes the window's transparency seems not able to be fetched)
Code:
#NumpadDiv::
   WinSet, Transparent, 255, A
Return

#NumpadMult::
   Gosub, WinGetTransparency
   If Transparency > 100
   {
      Transparency -= 30
      WinSet, Transparent, %Transparency%, A
   }
Return

WinGetTransparency:
   WinGet, Transparency, Transparent, A
   If Transparency =
      Transparency = 200
Return
Back to top
numEric



Joined: 27 Aug 2004
Posts: 30
Location: France

PostPosted: Sat Jun 03, 2006 6:49 pm    Post subject: Latest version! Reply with quote

Arrow The latest version is available here: Transparency.ahk
Back to top
View user's profile Send private message
XavierGr



Joined: 15 Jul 2006
Posts: 48

PostPosted: Mon Oct 29, 2007 3:02 pm    Post subject: Reply with quote

Sorry but this script seems like an overkill for its task.

Why not set 2 hotkeys and do the job right away inside them?

Code:
; Set Transparency of Windows Up (Opaque)
^+WheelUp::
    WinID := WinExist("A")
    WinGet, Trans, Transparent, ahk_id %WinID%
   
    if(!Trans)
        Trans := 254
       
    if(Trans < 255)
        Trans := Trans + 5
       
    if(Trans >= 255)
        Trans := "Off"

    ToolTip, % "Transparency: " Trans
    SetTimer, ReSetToolTip, 1000
    WinSet, Transparent, %Trans%, ahk_id %WinID%
return

; Set Transparency of Windows Down (Transparent)
^+WheelDown::
    WinID := WinExist("A")
    WinGet, Trans, Transparent, ahk_id %WinID%
   
    if(!Trans)
        Trans := 254
   
    if(Trans > 30)
        Trans := Trans - 5
       
    if(Trans >= 255)
        Trans := "Off"
   
    ToolTip, % "Transparency: " Trans
    SetTimer, ReSetToolTip, 1000
    WinSet, Transparent, %Trans%, ahk_id %WinID%
return


Ok I know that this will not prevent transparency on the Program Manager or the Task Manager but it is rather simpler and straightforward.

Side note: Does anyone know why when transparency is set to anything but "Off" (via winset), the transparent window turns black for a moment when I restore it from minimized position? It is rather annoying, do you get that kind of behavior?
_________________
One hotkey to rule them all!
Back to top
View user's profile Send private message
happytodd
Guest





PostPosted: Mon Nov 12, 2007 8:57 am    Post subject: nice work. Reply with quote

Took my a while to work it out. Did it on desktop then I thought you need a window open and it works Very Happy But its laggy with a few windows open
Back to top
XavierGr



Joined: 15 Jul 2006
Posts: 48

PostPosted: Mon Nov 12, 2007 11:53 pm    Post subject: Reply with quote

Here is my finished version, safe, without duplications and I hope without unneeded tasks and fast too:

Code:

; Set Transparency of Windows
^+WheelUp:: SetTransparency(10)
^+WheelDown:: SetTransparency(-10)

SetTransparency(Alpha)
{
    WinGet, WinID, ID, A
    WinGetClass, WinClass, A
    WinGet, Trans, Transparent, ahk_id %WinID%
   
    ; Don't make Transparent those special Windows
    if(WinID = "" || WinClass = "Progman" || WinClass = "Shell_TrayWnd" || WinClass = "WorkerW" || WinClass = "MsgrIMEWindowClass")
        return
   
    ; Set Transparency On
    if(Trans = "")
        Trans := 250
   
    ; Set Transparency Level
    Trans := Trans + Alpha
    if(Trans < 30)
        Trans := 30
       
    if(Trans >= 255)
        Trans := "Off"
   
    ToolTip, % "Transparency: " Trans
    SetTimer, ReSetToolTip, 1000
    WinSet, Transparent, %Trans%, ahk_id %WinID%
}

; Clear the ToolTip
ReSetToolTip:
    ToolTip
    SetTimer, ReSetToolTip, Off
return

_________________
One hotkey to rule them all!
Back to top
View user's profile Send private message
charmander91



Joined: 27 Oct 2007
Posts: 39
Location: olney, maryland

PostPosted: Fri Nov 16, 2007 6:08 pm    Post subject: Reply with quote

hey this is an amazing program, i use it in school all the time. i also added a command that when u press windows key + h it changes the title. the opacity also goes down to 3.

Code:
#SingleInstance Force
#MaxThreadsPerHotkey 10

SetBatchLines, -1
AutoTrim, Off

AlphaIncrement = 8.5

Ctrl & MButton::
   GetKeyState, ShiftState, Shift
   If ShiftState = U
   {
      Return
   }
   Gosub, WinGetTransparency
   Gosub, WinSetTransparency
   Gosub, ShowTransparencyToolTip
Return

Ctrl & WheelDown::
   GetKeyState, ShiftState, Shift
   If ShiftState = U
   {
      Return
   }
   Gosub, WinGetTransparency
   Trans0 -= 11
   Gosub, WinSetTransparency
   Gosub, ShowTransparencyToolTip

Return

Ctrl & WheelUp::
   GetKeyState, ShiftState, Shift
   If ShiftState = U
   {
      Return
   }
   Gosub, WinGetTransparency
   Trans0 += 11
   Gosub, WinSetTransparency
   Gosub, ShowTransparencyToolTip
Return

WinGetTransparency:
   MouseGetPos, , , WindowID
   If Trans_%WindowID% =
   {
      Trans_%WindowID% = 100
   }
   StringTrimRight, Trans, Trans_%WindowID%, 0
   Trans0 = %Trans%
Return

WinSetTransparency:
   WinGetClass, WindowClass, ahk_id %WindowID%
   If WindowClass = Progman
   {
      Trans0 = 100
   }
   Else If Trans0 < 1
   {
      Trans0 = 3
   }
   Else If Trans0 > 100
   {
      Trans0 = 100
   }
   a = %Trans%
   b = %Trans0%
   Trans = %Trans0%
   Trans_%WindowID% = %Trans%
   If WindowClass = Progman
   {
      Return
   }
   a *= 2.55
   Alpha0 = %a%            ; Starting Alpha
   b *= 2.55
   Alpha = %b%
   Transform, Alpha, Round, %Alpha%   ; Ending Alpha
   c = %Alpha0%            ; Init iteration var.
   d = %Alpha%
   d -= %Alpha0%         ; Range to iterate
   Transform, e, Abs, %d%
   If e > 0
   {
      f = %d%
      f /= %e%            ; Unity increment (+/- 1)
   }
   Else
   {
      f = 0
   }
   g = %f%
   g *= %AlphaIncrement%      ; Increment
   Loop
   {
      Transform, c, Round, %c%
      WinSet, Trans, %c%, ahk_id %WindowID%
      If c = %Alpha%
      {
         Break
      }
      Else If e >= %AlphaIncrement%
      {
         c += %g%
         e -= %AlphaIncrement%
      }
      Else
      {
         c = %Alpha%
      }
   }
Return

ShowTransparencyToolTip:
   h = %Trans%
   h /= 4
   i = 25
   i -= %h%
   ToolTipText = Opacity :%A_Space%
   Loop, %h%
   {
      ToolTipText = %ToolTipText%|
   }
   If h > 0
   {
      ToolTipText = %ToolTipText%%A_Space%
   }
   ToolTipText = %ToolTipText%%Trans%`%
   If i > 0
   {
      ToolTipText = %ToolTipText%%A_Space%
   }
   Loop, %i%
   {
      ToolTipText = %ToolTipText%|
   }
   ToolTip, %TooltipText%
   MouseGetPos, MouseX0, MouseY0
   SetTimer, RemoveToolTip
Return

RemoveToolTip:
   If A_TimeIdle < 1000
   {
      MouseGetPos, MouseX, MouseY
      If MouseX = %MouseX0%
      {
         If MouseY = %MouseY0%
         {
            Return
         }
      }
   }
   SetTimer, RemoveToolTip, Off
   ToolTip
Return

#h::
WinExist("A") ; Set the "last found window" to the current active window
WinSetTitle, College Search - SAT Reg... ; set the title to "College Search - SAT Reg"
return
#numpad9::exitapp

_________________
ehh... ill draw a pic of a charmander later
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
ph34r
Guest





PostPosted: Sun Nov 18, 2007 2:05 am    Post subject: Reply with quote

Works great, but I somehow managed to change the opacity of my desktop, and it won't go back, looks better though Laughing
Back to top
charmander91



Joined: 27 Oct 2007
Posts: 39
Location: olney, maryland

PostPosted: Sun Nov 18, 2007 4:54 am    Post subject: Reply with quote

ph34r wrote:
Works great, but I somehow managed to change the opacity of my desktop, and it won't go back, looks better though Laughing


haha yea, i had that problem too, i had no idea how i did the desktop tho
_________________
ehh... ill draw a pic of a charmander later
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lilljimpa



Joined: 18 Apr 2007
Posts: 127

PostPosted: Sun Nov 18, 2007 10:10 pm    Post subject: Reply with quote

i thing that it whuld be better if the icon menu shuld have a:

"set all windows to 100%" button

and a own exit button that will make all windows go back to 100% wen you exit app.

(it whuld solve the problem when you can´t get the windows back
and if you by accident in some how would not get the taskbar back you could add a keyword to exit app.)

and meaby a "only exit witout transper"




i am just come up with idéas. I am not that good in ahk so i can do it by my own. but i like the script very very much

i just came up with a another idea...
if you whuld right click on a windows in the taskbar (with ctrl+shift or i dont know) you could choose transpear stright. this whould alsow solve the problem of when you cant get the windows back.

i dont know what is possible to do whit ahk. meaby everything is possible if you are good on it.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Deller



Joined: 21 Nov 2007
Posts: 239
Location: 0x01101110

PostPosted: Wed Nov 21, 2007 11:20 pm    Post subject: Reply with quote

How long did it take you to make that. It works great!
Back to top
View user's profile Send private message
slyshot1
Guest





PostPosted: Sun Feb 24, 2008 4:43 pm    Post subject: Reply with quote

i built a little variation:

Code:
#SingleInstance Force
#MaxThreadsPerHotkey 10

SetBatchLines, -1
AutoTrim, Off

AlphaIncrement = 8.5

Ctrl & MButton::
   GetKeyState, ShiftState, Shift
   If ShiftState = U
   {
      Return
   }
   Gosub, WinGetTransparency
   Gosub, WinSetTransparency
   Gosub, ShowTransparencyToolTip
Return

Ctrl & WheelDown::
   GetKeyState, ShiftState, Shift
   If ShiftState = U
   {
      Return
   }
   Gosub, WinGetTransparency
   If Trans0 <= 10
   {
      Trans0 -= 2
   }
   Else
   {
      Trans0 -= 10
   }
   Gosub, WinSetTransparency
   Gosub, ShowTransparencyToolTip
Return

Ctrl & WheelUp::
   GetKeyState, ShiftState, Shift
   If ShiftState = U
   {
      Return
   }
   Gosub, WinGetTransparency
   If Trans0 <= 10
   {
      Trans0 += 2
   }
   Else
   {
      Trans0 += 10
   }
   Gosub, WinSetTransparency
   Gosub, ShowTransparencyToolTip
Return

WinGetTransparency:
   MouseGetPos, , , WindowID
   If Trans_%WindowID% =
   {
      Trans_%WindowID% = 100
   }
   StringTrimRight, Trans, Trans_%WindowID%, 0
   Trans0 = %Trans%
Return

WinSetTransparency:
   WinGetClass, WindowClass, ahk_id %WindowID%
   If WindowClass = Progman
   {
      Trans0 = 100
   }
   Else If Trans0 < 2
   {
      Trans0 = 2
   }
   Else If Trans0 > 100
   {
      Trans0 = 100
   }
   a = %Trans%
   b = %Trans0%
   Trans = %Trans0%
   Trans_%WindowID% = %Trans%
   If WindowClass = Progman
   {
      Return
   }
   a *= 2.55
   Alpha0 = %a%            ; Starting Alpha
   b *= 2.55
   Alpha = %b%
   Transform, Alpha, Round, %Alpha%   ; Ending Alpha
   c = %Alpha0%            ; Init iteration var.
   d = %Alpha%
   d -= %Alpha0%         ; Range to iterate
   Transform, e, Abs, %d%
   If e > 0
   {
      f = %d%
      f /= %e%            ; Unity increment (+/- 1)
   }
   Else
   {
      f = 0
   }
   g = %f%
   g *= %AlphaIncrement%      ; Increment
   Loop
   {
      Transform, c, Round, %c%
      WinSet, Trans, %c%, ahk_id %WindowID%
      If c = %Alpha%
      {
         Break
      }
      Else If e >= %AlphaIncrement%
      {
         c += %g%
         e -= %AlphaIncrement%
      }
      Else
      {
         c = %Alpha%
      }
   }
Return

ShowTransparencyToolTip:
   h = %Trans%
   h /= 4
   i = 25
   i -= %h%
   ToolTipText = Opacity :%A_Space%
   Loop, %h%
   {
      ToolTipText = %ToolTipText%|
   }
   If h > 0
   {
      ToolTipText = %ToolTipText%%A_Space%
   }
   ToolTipText = %ToolTipText%%Trans%`%
   If i > 0
   {
      ToolTipText = %ToolTipText%%A_Space%
   }
   Loop, %i%
   {
      ToolTipText = %ToolTipText%|
   }
   ToolTip, %TooltipText%
   MouseGetPos, MouseX0, MouseY0
   SetTimer, RemoveToolTip
Return

RemoveToolTip:
   If A_TimeIdle < 1000
   {
      MouseGetPos, MouseX, MouseY
      If MouseX = %MouseX0%
      {
         If MouseY = %MouseY0%
         {
            Return
         }
      }
   }
   SetTimer, RemoveToolTip, Off
   ToolTip
Return


makes the end nicer.
Back to top
Aaon2
Guest





PostPosted: Fri Mar 21, 2008 6:18 pm    Post subject: Reply with quote

This works perfectly for me. I shoved the ahk script into my startup folder and it's just one more feature of XP now. I did notice however when I compiled it, it wouldn't work. So for the guys who says it's not working try to not compile it. Other than that GREAT JOB!!!
Back to top
NPT



Joined: 11 Apr 2008
Posts: 5

PostPosted: Fri May 30, 2008 12:57 pm    Post subject: Reply with quote

Is there a way to make the transparency work with a firefox tool bar? This works perfectly for my actual browser window, but the transparency does not apply to my Roboform tool bar. I would like to be able to make this blend in as well.

Any suggestions?
Back to top
View user's profile Send private message
Red Hat Boy



Joined: 10 Apr 2008
Posts: 111

PostPosted: Mon Jun 02, 2008 7:54 am    Post subject: Reply with quote

Wow. That's pretty cool. It didn't even cross my mind to use the mouse wheel, but I wrote something similar:
Code:

; this small section at beginning of the script
BarTransparency := 200
WienerTransparency := 255
; -----


; TASKBAR TRANSPARENCY!!!
Numpad0 & Down::
BarTransparency -= 50
if ( BarTransparency < 0 ) {
BarTransparency := 0
}
WinSet, Transparent, %BarTransparency%, ahk_class Shell_TrayWnd
return

Numpad0 & Up::
BarTransparency += 50
if ( BarTransparency >= 250 ) {
BarTransparency := 255
WinSet, Transparent, 255, ahk_class Shell_TrayWnd
WinSet, Transparent, Off, ahk_class Shell_TrayWnd
}
else {
WinSet, Transparent, %BarTransparency%, ahk_class Shell_TrayWnd
}
return

; GUI TRANSPARENCY!!!
Numpad0 & Left::
WienerTransparency -= 50
if ( WienerTransparency < 0 ) {
WienerTransparency := 0
}
WinGetActiveStats, Title, Width, Height, X, Y
WinSet, Transparent, %WienerTransparency%, %Title%
return

Numpad0 & Right::
WienerTransparency += 50
if ( WienerTransparency >= 250 ) {
WienerTransparency := 255
WinGetActiveStats, Title, Width, Height, X, Y
WinSet, Transparent, 255, %Title%
WinSet, Transparent, Off, %Title%
}
else {
WinGetActiveStats, Title, Width, Height, X, Y
WinSet, Transparent, %WienerTransparency%, %Title%
}
return

lol, sorry about the silly variable name. Don't know what I was smoking when I wrote that. Rolling Eyes
_________________
I slit the sheet, the sheet I slit,
and on the slitted sheet I sit. ;~}
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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