Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hopefully a simple question with an equally simple answer...

I'm trying to make an autohotkey script to toggle window transparency.

Currently, I'm setting the active window transparency with the following:

^!RButton::WinSet, Transparent, 150, A

However, I'd like to extend this to toggle between 150 and 255, but am having a difficult time grasping how to toggle this.


Edit: By toggle, I'm meaning hit Ctrl+Alt+Right Mouse Button once to set the transparency to 150, and then hitting it again to set the window back to full transparency.

share|improve this question
up vote 6 down vote accepted

Something like this would probably do it (untested):

^!RButton::
WinGet, currentTransparency, Transparent, A
if (currentTransparency = 150)
{
    WinSet, Transparent, OFF, A
}
else
{
    WinSet, Transparent, 150, A
}
return
share|improve this answer
1  
I run that, and the AHK script simply toggles when I start the script...I need to rerun it to change transparency. – espais Apr 20 '11 at 16:19
1  
ah, found the problem...^!RButton:: – espais Apr 20 '11 at 20:43
1  
Fixed my example. Thanks! – ranomore Apr 20 '11 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .