Advertisement
Guest User

Untitled

a guest
Feb 12th, 2019
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. SetWinDelay,2 ; raise or lower if laggy, 2 default
  6. CoordMode,Mouse
  7.  
  8. ; 12 February 2019
  9.  
  10. Menu, HelpMenu, Add, Exit(Ctrl+Delete), Exit
  11. Menu, HelpMenu, Add, Switch Virtual Desktop(Alt+Mouse5/4), return
  12. Menu, HelpMenu, Add, Volume(Shift+Alt+Up or Down), return
  13. Menu, HelpMenu, Add, Mute(Shift+Alt+Left), return
  14. Menu, HelpMenu, Add, Play/Pause(Shift+Alt+Right), return
  15. Menu, HelpMenu, Add, Slow Spam Left Mouse(Ctrl+Shift), return
  16. Menu, HelpMenu, Add, Spam Left Mouse(Ctrl+Alt), return
  17. Menu, HelpMenu, Add, MEGA Spam Left Mouse(Ctrl+Shift+Alt), return
  18. Menu, HelpMenu, Add, Multi-Clipboard Copy(Ctrl+Shift+NUMBER), return
  19. Menu, HelpMenu, Add, Multi-Clipboard Paster(Ctrl+Alt+NUMBER), return
  20. Menu, HelpMenu, Add, Move`, Resize(Alt+Click&&Drag&&Scroll Lock Off), return
  21. Menu, HelpMenu, Add, Minimize`, Maximize`, Close(Alt*2+Click), return
  22. Menu, HelpMenu, Add, Borderless Fullscreen(Shift+Alt+F), return
  23. Menu, HelpMenu, Add, Set Window to Always be on Top, return
  24. Menu, Tray, Add, Features, :HelpMenu ; must define a menu's contents before adding it for some reason
  25.  
  26. Msgbox, 0, Quick Windows Shortcuts, Version 0.3 By Asher Finendale`n`nAfinendale35@gmail.com, 1.5
  27. return
  28.  
  29. return:
  30. return
  31.  
  32. Exit:
  33. ^delete::
  34. send {alt up}
  35. send {ctrl up}
  36. send {win up}
  37. send {shift up}
  38. exitapp
  39. return
  40.  
  41. SwitchR:
  42. !xbutton2:: ;switch virtual desktop, sometimes makes taskbar icons flash
  43. send ^#{right}
  44. return
  45. !xbutton1::
  46. send ^#{left}
  47. return
  48.  
  49. !+up:: Send {Volume_Up}
  50. !+down:: Send {Volume_Down}
  51. !+left:: Send {Volume_Mute}
  52. !+Right:: Send {Media_Play_Pause}
  53.  
  54. $^!+LButton:: ; Ctrl Alt Shift
  55. While GetKeyState("LButton", "P"){
  56.     Click
  57.     Sleep 1
  58. } return
  59. $^!LButton:: ; Ctrl Alt
  60. While GetKeyState("LButton", "P"){
  61.     Click
  62.     Sleep 25
  63. } return
  64. $^+LButton:: ; Ctrl Shift
  65. While GetKeyState("LButton", "P"){
  66.     Click
  67.     Sleep 50
  68. } return
  69.    
  70. fullwindow:
  71. +!f:: ;shift alt f
  72. WinGetTitle, currentWindow, A
  73. IfWinExist %currentWindow%
  74. {
  75.    WinSet, Style, -0x400000 ; hides the dialog frame
  76.    WinSet, Style, -0x40000 ; hides the sizebox/thickframe
  77.    WinSet, Style, -0x800000 ; hides the thin-line border
  78.    WinSet, Style, -0xC00000 ; hides the title bar
  79.    WinSet, top ; move to top
  80.    WinMove, , , 0, 0, 1920, 1080 ; moves the entire window to 0,0 i.e. upper left corner.
  81. } return
  82.  
  83. +!t:: WinSet, top ; Shift Alt t ; move to top
  84. +!a:: Winset, Alwaysontop, , A ;On top of other windows
  85.  
  86. $^+1:: ;ctrl shift 1 ; copies to first clip board, ctrl alt 1 pastes 1st clipboard
  87. windowsclipboard := clipboard ; make sure win clipboard is persistent
  88. send ^c
  89. sleep 100
  90. clip1 := clipboard ; ahk clipboard
  91. clipboard := windowsclipboard ; make sure win clipboard is persistent
  92. return
  93. $^+2::
  94. windowsclipboard := clipboard
  95. send ^c
  96. sleep 100
  97. clip2 := clipboard
  98. clipboard := windowsclipboard
  99. return
  100. $^+3::
  101. windowsclipboard := clipboard
  102. send ^c
  103. sleep 100
  104. clip3 := clipboard
  105. clipboard := windowsclipboard
  106. return
  107. $^+4::
  108. windowsclipboard := clipboard
  109. send ^c
  110. sleep 100
  111. clip4 := clipboard
  112. clipboard := windowsclipboard
  113. return
  114. $^+5::
  115. windowsclipboard := clipboard
  116. send ^c
  117. sleep 100
  118. clip5 := clipboard
  119. clipboard := windowsclipboard
  120. return
  121. $^+6::
  122. windowsclipboard := clipboard
  123. send ^c
  124. sleep 100
  125. clip6 := clipboard
  126. clipboard := windowsclipboard
  127. return
  128. $^+7::
  129. windowsclipboard := clipboard
  130. send ^c
  131. sleep 100
  132. clip7 := clipboard
  133. clipboard := windowsclipboard
  134. return
  135. $^+8::
  136. windowsclipboard := clipboard
  137. send ^c
  138. sleep 100
  139. clip8 := clipboard
  140. clipboard := windowsclipboard
  141. return
  142. $^+9::
  143. windowsclipboard := clipboard
  144. send ^c
  145. sleep 100
  146. clip9 := clipboard
  147. clipboard := windowsclipboard
  148. return
  149. $^+0::
  150. windowsclipboard := clipboard
  151. send ^c
  152. sleep 100
  153. clip0 := clipboard
  154. clipboard := windowsclipboard
  155. return
  156. $^!1:: ;ctrl alt 1
  157. sendraw % clip1 ; send +t+e+x+t instead of TEXT
  158. return
  159. $^!2::
  160. sendraw % clip2
  161. return
  162. $^!3::
  163. sendraw % clip3
  164. return
  165. $^!4::
  166. sendraw % clip4
  167. return
  168. $^!5::
  169. sendraw % clip5
  170. return
  171. $^!6::
  172. sendraw % clip6
  173. return
  174. $^!7::
  175. sendraw % clip7
  176. return
  177. $^!8::
  178. sendraw % clip8
  179. return
  180. $^!9::
  181. sendraw % clip9
  182. return
  183. $^!0::
  184. sendraw % clip0
  185. return
  186.  
  187. ;  Alt + Left Button  : Drag to move a window.
  188. ;  Alt + Right Button : Drag to resize a window.
  189. ;  Double-Alt + Left Button   : Minimize a window.
  190. ;  Double-Alt + Right Button  : Maximize/Restore a window.
  191. ;  Double-Alt + Middle Button : Close a wialtndow.
  192.  
  193. #if GetKeyState("ScrollLock", "T") = 0 ; only move windows if scroll lock is on
  194. $!LButton::
  195. If DoubleAlt
  196. {
  197.     MouseGetPos,,,KDE_id
  198.     PostMessage,0x112,0xf020,,,ahk_id %KDE_id% ; This message is mostly equivalent to WinMinimize, but it avoids a bug with PSPad.
  199.     DoubleAlt := false
  200.     return
  201. }
  202. MouseGetPos,KDE_X1,KDE_Y1,KDE_id ; Get the initial mouse position and window id, and abort if the window is maximized.
  203. WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
  204. If KDE_Win
  205.     return
  206. WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id% ; Get the initial window position.
  207. Loop
  208. {
  209.     GetKeyState,KDE_Button,LButton,P ; Break if button has been released.
  210.     If KDE_Button = U
  211.         break
  212.     MouseGetPos,KDE_X2,KDE_Y2 ; Get the current mouse position.
  213.     KDE_X2 -= KDE_X1 ; Obtain an offset from the initial mouse position.
  214.     KDE_Y2 -= KDE_Y1
  215.     KDE_WinX2 := (KDE_WinX1 + KDE_X2) ; Apply this offset to the window position.
  216.     KDE_WinY2 := (KDE_WinY1 + KDE_Y2)
  217.     WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2% ; Move the window to the new position.
  218. }
  219. return
  220.  
  221. $!RButton::
  222. If DoubleAlt
  223. {
  224.     MouseGetPos,,,KDE_id ; Toggle between maximized and restored state.
  225.     WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
  226.     If KDE_Win
  227.         WinRestore,ahk_id %KDE_id%
  228.     Else
  229.         WinMaximize,ahk_id %KDE_id%
  230.     DoubleAlt := false
  231.     return
  232. }
  233. MouseGetPos,KDE_X1,KDE_Y1,KDE_id ; Get the initial mouse position and window id, and abort if the window is maximized.
  234. WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
  235. If KDE_Win
  236.     return
  237. WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% ; Get the initial window position and size.
  238. If (KDE_X1 < KDE_WinX1 + KDE_WinW / 2) ; Define the window region the mouse is currently in. The four regions are Up and Left, Up and Right, Down and Left, Down and Right.
  239.     KDE_WinLeft := 1
  240. Else
  241.     KDE_WinLeft := -1
  242. If (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2)
  243.     KDE_WinUp := 1
  244. Else
  245.     KDE_WinUp := -1
  246. Loop
  247. {
  248.     GetKeyState,KDE_Button,RButton,P ; Break if button has been released.
  249.     If KDE_Button = U
  250.         break
  251.     MouseGetPos,KDE_X2,KDE_Y2 ; Get the current mouse position.
  252.     WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% ; Get the current window position and size.
  253.     KDE_X2 -= KDE_X1 ; Obtain an offset from the initial mouse position.
  254.     KDE_Y2 -= KDE_Y1 ; Then, act according to the defined region.
  255.     WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2  ; X of resized window
  256.                             , KDE_WinY1 +   (KDE_WinUp+1)/2*KDE_Y2  ; Y of resized window
  257.                             , KDE_WinW  -     KDE_WinLeft  *KDE_X2  ; W of resized window
  258.                             , KDE_WinH  -       KDE_WinUp  *KDE_Y2  ; H of resized window
  259.     KDE_X1 := (KDE_X2 + KDE_X1) ; Reset the initial position for the next iteration.
  260.     KDE_Y1 := (KDE_Y2 + KDE_Y1)
  261. }
  262. return
  263.  
  264. $!MButton::
  265. If DoubleAlt
  266. {
  267.     MouseGetPos,,,KDE_id
  268.     WinClose,ahk_id %KDE_id%
  269.     DoubleAlt := false
  270.     return
  271. }
  272. return
  273.  
  274. ~Alt:: ; This detects "double-clicks" of the alt key.
  275. DoubleAlt := A_PriorHotkey = "~Alt" AND A_TimeSincePriorHotkey < 400
  276. Sleep 0
  277. KeyWait Alt  ; This prevents the keyboard's auto-repeat feature from interfering.
  278. return
  279. #if ; end of #if scroll lock
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement