Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2013
1,664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #InstallKeybdHook
  2. #SingleInstance force
  3. /*
  4. Hotkeys:
  5. Alt-A: make window always on top
  6.  
  7. Alt-W: make window less transparent
  8. Alt-S: make window more transparent
  9.  
  10. Alt-X: make window clickthoughable
  11. Alt-Z: make window under mouse unclickthroughable
  12. */
  13. winArr := Object()
  14. OnExit, Exit
  15.  
  16. !a::
  17. WinGet, currentWindow, ID, A
  18. addToWinArr(currentWindow)
  19. WinGet, ExStyle, ExStyle, ahk_id %currentWindow%
  20. if (ExStyle & 0x8)  ; 0x8 is WS_EX_TOPMOST.
  21. {
  22.     Winset, AlwaysOnTop, off, ahk_id %currentWindow%
  23.     SplashImage,, x0 y0 b fs12, OFF always on top.
  24.     Sleep, 1500
  25.     SplashImage, Off
  26. }
  27. else
  28. {
  29.     WinSet, AlwaysOnTop, on, ahk_id %currentWindow%
  30.     SplashImage,,x0 y0 b fs12, ON always on top.
  31.     Sleep, 1500
  32.     SplashImage, Off
  33. }
  34. return
  35.  
  36. !w::
  37. WinGet, currentWindow, ID, A
  38. addToWinArr(currentWindow)
  39. if not (%currentWindow%)
  40. {
  41.     %currentWindow% := 255
  42. }
  43. if (%currentWindow% != 255)
  44. {
  45.     %currentWindow% += 5
  46.     WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
  47. }
  48. SplashImage,,w100 x0 y0 b fs12, % %currentWindow%
  49. SetTimer, TurnOffSI, 1000, On
  50. Return
  51.  
  52. !s::
  53. SplashImage, Off
  54. WinGet, currentWindow, ID, A
  55. addToWinArr(currentWindow)
  56. if not (%currentWindow%)
  57. {
  58.     %currentWindow% := 255
  59. }
  60. if (%currentWindow% != 5)
  61. {
  62.     %currentWindow% -= 5
  63.     WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
  64. }
  65. SplashImage,, w100 x0 y0 b fs12, % %currentWindow%
  66. SetTimer, TurnOffSI, 1000, On
  67. Return
  68.  
  69. !x::
  70. WinGet, currentWindow, ID, A
  71. addToWinArr(currentWindow)
  72. WinSet, ExStyle, +0x80020, ahk_id %currentWindow%
  73. return
  74.  
  75. !z::
  76. MouseGetPos,,, MouseWin ; Gets the unique ID of the window under the mouse
  77. addToWinArr(MouseWin)
  78. WinSet, ExStyle, -0x80020, ahk_id %currentWindow%
  79. Return
  80.  
  81. TurnOffSI:
  82. SplashImage, off
  83. SetTimer, TurnOffSI, 1000, Off
  84. Return
  85.  
  86. addToWinArr(chwnd){
  87.     global winArr
  88.     if (!winArr.hasKey(chwnd))
  89.         winArr[chwnd] := true
  90. }
  91.  
  92. Exit:
  93.     for currentWindow, b in winArr
  94.     {
  95.         WinSet, ExStyle, -0x80020, ahk_id %currentWindow%
  96.         WinSet, Trans, 255, ahk_id %currentWindow%
  97.         Winset, AlwaysOnTop, off, ahk_id %currentWindow%
  98.     }
  99.     ExitApp
  100. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement