Advertisement
Nick_Fair

AlwaysOnTop+ AutoHotKey Script Beta 0.0.1

Apr 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. #InstallKeybdHook
  2. #SingleInstance force
  3. #Persistent
  4. /*
  5. Hotkeys:
  6. Alt-A: make window always on top
  7.  
  8. Alt-W: make window less transparent
  9. Alt-S: make window more transparent
  10.  
  11. Alt-X: make window clickthoughable
  12. Alt-Z: make window under mouse unclickthroughable
  13.  
  14. Code by NickFizzer
  15.  
  16. */
  17.  
  18. ;global UI=1
  19.  
  20.  
  21.  
  22.  
  23. OnExit, ExitSub
  24.  
  25. Menu, Tray, NoStandard
  26. Menu, Tray, Add, Restore, RestoreTray
  27. Menu, Tray, Add,
  28. Menu, Tray, Add, Donate, Donate
  29. Menu, Tray, Add,
  30. Menu, Tray, Add, Exit, ExitSub
  31. Menu, Tray, Default, Restore
  32.  
  33.  
  34.  
  35. ; This SHOULD read the value of UI in the config.ini and start visible, or insivisble
  36. ;IniRead, UI, Config.ini, User Interface, UI
  37. ;if UI=0
  38. ; goto RestoreTray
  39. ;else
  40. ; goto MinimizeTrayS
  41.  
  42.  
  43.  
  44.  
  45. ;Simple GUI Stuff
  46. Gui -SysMenu
  47. Gui, +AlwaysOnTop +ToolWindow -Caption
  48. Gui,Margin, 0, 0
  49.  
  50. Gui, Color, 000000
  51. Gui, Show, x1850 y800 w500 h300, AlwaysOnTop+
  52. Gui, Font, s28 caqua, Terminal
  53. WinSet, Transparent, 180, AlwaysOnTop+
  54. Gui, Add, Text, x10, AlwaysOnTop+ Beta 0.0.1
  55. Gui, Font, s10 caqua, Terminal
  56. Gui, Add, Text, x20, By NickFair (Reddit)
  57. Gui, Add, Text, x44, Nick_Fair (Twitch)
  58. Gui, Add, Text, x15,
  59. Gui, Add, Text, x4, Commands:
  60. Gui, Font, s10 caqua, Terminal
  61. Gui, Add, Text, x15, Ctrl-Alt-A: Pin The Selected Window on Top
  62. Gui, Add, Text, x15, Ctrl-Alt-W: Make Window More Transparent
  63. Gui, Add, Text, x15, Ctrl-Alt-S: Make Window Less Transparent
  64. Gui, Add, Text, x15, Ctrl-Alt-X: Enable Click-through on Window
  65. Gui, Add, Text, x15, Ctrl-Alt-Z: Disable Click-through on Window
  66. Gui, Add, Text, x15,
  67. Gui, Add, Text, x15,
  68. Gui, Add, Text, x30, Ctrl-Alt-Q: Hide/Show UI Ctrl-Alt-C: Close AOT+
  69. Gui, Add, Text, x15,
  70. Gui, Add, Text, w40 h20 Border Center yCenter GuiMove, Move
  71. Gui, Add, Text, w40 h20 Border Center yCenter gGuiClose, X
  72.  
  73. Gui, Show, AutoSize
  74.  
  75. Return
  76.  
  77. uiMove:
  78. PostMessage, 0xA1, 2,,, A
  79. Return
  80.  
  81. ;UI Toggle Hotkey
  82. ;!Q::
  83. ;Show_UI:=!Show_UI=1
  84. ;return
  85.  
  86. ;BETA UI TOGGLE
  87. ;^!Q::
  88. ;UI:=!UI
  89. ;if UI=1
  90. ; gui, show, NoActivate
  91. ;else
  92. ; gui, hide
  93.  
  94. ;return
  95.  
  96.  
  97. ^!Q::
  98. ;UI:=!UI
  99. if UI=1
  100. goto RestoreTray
  101. else
  102. goto MinimizeTray
  103.  
  104. return
  105.  
  106.  
  107. /*Quick Exit Script
  108. */
  109. ^!c::ExitApp
  110.  
  111. return
  112.  
  113.  
  114. Donate:
  115. Run https://streamelements.com/nick_fair/tip
  116.  
  117. return
  118.  
  119. MinimizeTray:
  120. Critical
  121. Gui, Hide
  122. Menu, Tray, Icon
  123. IniWrite, 1, Config.ini, User Interface, UI
  124. TrayTip, AOT+ Minimized, Double Click Icon to Restore, 32
  125. Sleep 3000 ; Let it display for 3 seconds.
  126. HideTrayTip()
  127. Return
  128.  
  129. MinimizeTrayS:
  130. Critical
  131. Gui, Hide
  132. Menu, Tray, Icon
  133. IniWrite, 1, Config.ini, User Interface, UI
  134. Return
  135.  
  136.  
  137.  
  138. RestoreTray:
  139. Critical
  140. ; Enable to disable app icon while
  141. ; Menu, Tray, NoIcon
  142. Gui, Show,
  143. IniWrite, 0, Config.ini, User Interface, UI
  144. Return
  145.  
  146. ;;On Close, App will save UI config to ini
  147. GuiClose:
  148. ExitSub:
  149. IniWrite, %UI%, Config.ini, User Interface, UI
  150. ExitApp
  151. return
  152.  
  153.  
  154. HideTrayTip() {
  155. TrayTip
  156. if SubStr(A_OSVersion,1,3) = "10." {
  157. Menu Tray, NoIcon
  158. Sleep 200
  159. Menu Tray, Icon
  160. }
  161. }
  162.  
  163.  
  164.  
  165. ;ALWAYS ON TOP BASIC FUNCTIONALITY
  166.  
  167. ^!a::
  168. WinGet, currentWindow, ID, A
  169. WinGet, ExStyle, ExStyle, ahk_id %currentWindow%
  170. if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST.
  171. {
  172. Winset, AlwaysOnTop, off, ahk_id %currentWindow%
  173. SplashImage,, x0 y0 b fs12, AOT OFF
  174. Sleep, 1500
  175. SplashImage, Off
  176. }
  177. else
  178. {
  179. WinSet, AlwaysOnTop, on, ahk_id %currentWindow%
  180. SplashImage,,x0 y0 b fs12, AOT ON
  181. Sleep, 1500
  182. SplashImage, Off
  183. }
  184. return
  185.  
  186. ^!w::
  187. WinGet, currentWindow, ID, A
  188. if not (%currentWindow%)
  189. {
  190. %currentWindow% := 255
  191. }
  192. if (%currentWindow% != 255)
  193. {
  194. %currentWindow% += 5
  195. WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
  196. }
  197. SplashImage,,w100 x0 y0 b fs12, % %currentWindow%
  198. SetTimer, TurnOffSI, 1000, On
  199. Return
  200.  
  201. ^!s::
  202. SplashImage, Off
  203. WinGet, currentWindow, ID, A
  204. if not (%currentWindow%)
  205. {
  206. %currentWindow% := 255
  207. }
  208. if (%currentWindow% != 5)
  209. {
  210. %currentWindow% -= 5
  211. WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
  212. }
  213. SplashImage,, w100 x0 y0 b fs12, % %currentWindow%
  214. SetTimer, TurnOffSI, 1000, On
  215. Return
  216.  
  217. ^!x::
  218. WinGet, currentWindow, ID, A
  219. WinSet, ExStyle, +0x80020, ahk_id %currentWindow%
  220. return
  221.  
  222. ^!z::
  223. MouseGetPos,,, MouseWin ; Gets the unique ID of the window under the mouse
  224. WinSet, ExStyle, -0x80020, ahk_id %currentWindow%
  225. Return
  226.  
  227. TurnOffSI:
  228. SplashImage, off
  229. SetTimer, TurnOffSI, 1000, Off
  230. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement