Mandrew

HotSweet - Grease and Pin modules

Sep 18th, 2012
89
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. *#WheelUp::
  10. *#WheelDown::
  11.  
  12. ; This calculates the adjustment factor then passes it on to the function DoTrans
  13. Trans := 10 * (GetKeyState("Ctrl") ? .5 : 1) * (GetKeyState("Alt") ? .2 : 1)
  14. If (A_ThisHotkey = "*#Insert" || A_ThisHotkey = "*#WheelUp")
  15.     DoTrans(Trans)
  16. Else
  17.     DoTrans(-Trans)
  18. Return
  19.  
  20. DoTrans(change) {
  21.     WinGet, old, Transparent, A
  22.     If (old = "")
  23.         old := 255
  24.     new := old + change
  25.     WinSet, Transparent, %new%, A
  26.     If (new => 255) ; saves resources when 100% opaque
  27.         WinSet, Transparent, OFF, A
  28.     Return
  29. }
  30.  
  31. /*
  32. ***
  33. PIN
  34. ***
  35. This will toggle always-on-top mode for the current window using #Home and display a helpful (if long) tooltip which displays the title of that window. #End always works as an un-pinner.
  36.  
  37. When using the mouse button hotkeys, it uses whichever window the cursor is over.
  38. */
  39. #Home::
  40. *#XButton2::
  41. WinSet, AlwaysOnTop, Toggle, A
  42. WinGetActiveTitle, wintit
  43. WinGet, ExStyle, ExStyle, %wintit%
  44. If (ExStyle & 0x8)
  45.     ToolTipDisplay(tt . wintit . " pinned!",-1000)
  46. Else
  47.     ToolTipDisplay(tt . wintit . " unpinned!",-1000)
  48. Return
  49.  
  50. #End::
  51. *#XButton1::
  52. WinSet, AlwaysOnTop, Off, A
  53. WinGetActiveTitle, wintit
  54. ToolTipDisplay(tt . wintit . " unpinned!",-1000)
  55. Return
Advertisement
Add Comment
Please, Sign In to add comment