Mandrew

HotSweet Grease module

Jun 8th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. ******
  3. GREASE
  4. ******
  5. This module adjusts the transparency of the active window by units of 10 using #Ins/#Del. Adding the Ctrl or Shift modifiers allows the user to fine-tune the transparency by reducing the increment to 5, 2, or 1 (hold down both).
  6. */
  7. *#Insert::
  8. *#Delete::
  9.  
  10. ; This calculates the adjustment factor then passes it on to the function DoTrans
  11. Trans := 10 * (GetKeyState("Ctrl") ? .5 : 1) * (GetKeyState("Alt") ? .2 : 1)
  12. If (A_ThisHotkey = "*#Insert")
  13.     DoTrans(Trans)
  14. Else
  15.     DoTrans(-Trans)
  16. Return
  17.  
  18. DoTrans(change) {
  19.     WinGet, old, Transparent, A
  20.     If (old = "")
  21.         old := 255
  22.     new := old + change
  23.     WinSet, Transparent, %new%, A
  24.     If (new => 255) ; saves resources when 100% opaque
  25.         WinSet, Transparent, OFF, A
  26.     Return
  27. }
Advertisement
Add Comment
Please, Sign In to add comment