7

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.

erik
  • 428

2 Answers2

13

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
Alex
  • 132
0

Here's another sample,

ClearTooltip:
  ToolTip
  return

>+>:: ;ToolTip right shift + > WinSet, Transparent, OFF, A return

>+<:: ;ToolTip right shift + < WinGet, t, Transparent, A if (not t) { t := 250 } t := t - 20 WinSet, Transparent, %t%, A ToolTip %t% SetTimer, ClearTooltip, -321 return

cf. https://superuser.com/a/582766/50938

ArtemGr
  • 337