Simple transparency toggle with Autohotkey

autohotkeytransparency

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.

Best Answer

Something like this would probably do it (untested):

^!RButton::
WinGet, currentTransparency, Transparent, A
if (currentTransparency = OFF)
{
    WinSet, Transparent, 150, A
}
else
{
    WinSet, Transparent, OFF, A
}
return
Related Question