congdantoancau

Fuhlen

Dec 8th, 2017
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ============== DELETE KEY CLOSE WINDOWS ===============
  2.  
  3. SetTitleMatchMode, 2
  4. #ifWinActive, VLC
  5. Del::
  6. #IfWinActive, Bkav
  7. Del::WinClose, a
  8. return
  9. #ifWinActive
  10.  
  11. ; ============== MISC KEY ===============
  12. ~lwin::
  13. if (A_PriorHotkey <> "~lwin" or A_TimeSincePriorHotkey > 400)
  14. {
  15.     KeyWait, lwin
  16.     return
  17. }
  18. run C:\Users\Fiong\Desktop\Prgrms
  19. return
  20.  
  21. ~rwin::
  22. if (A_PriorHotkey <> "~rwin" or A_TimeSincePriorHotkey > 600)
  23. {
  24.     KeyWait, rwin
  25.     return
  26. }
  27. send, !{tab}
  28. return
  29. Insert::^a
  30. return
  31.  
  32.  
  33.  
  34. ; ================ MACRO ===================
  35. :*:nl::NULL
  36. return
  37.  
  38. ; ============== WINDOWS CLASS ==============
  39. +#q::
  40. WinGetClass, class, A
  41. MsgBox, The active window's class is "%class%".
  42. return
  43.  
  44. ; ============= KUGOU ================
  45. ; Turn off advertisment
  46. ^+k::
  47. MouseMove, 1100, 700, 10
  48. return
  49.  
  50. ; ===================== CHROME ======================
  51. SetTitleMatchMode, 2
  52. #ifWinActive, Chrome
  53. Appskey::^s
  54. return
  55. #ifWinActive
  56.  
  57.  
  58. ; ======================= VISUAL STUDIO =====================
  59.  
  60. ; ======================= SCROLL LOCK ======================
  61. SetScrollLockState, On ;Turn SLock on at windows startup
  62. return
  63. ;https://autohotkey.com/docs/commands/SetNumScrollCapsLockState.htm
  64.  
  65. #If GetKeyState("ScrollLock", "T")
  66. ~pause::Media_Play_Pause
  67. return
  68. NumpadIns::Media_Play_Pause
  69. return
  70. NumpadDel::Media_Stop
  71. return
  72. NumpadDiv::media_prev
  73. return
  74. NumpadMult::media_next
  75. return
  76. #If
  77.  
  78. ; ================== GENERAL =====================
  79. ; Empty trash
  80. ; Source: (#8) https://www.maketecheasier.com/favorite-autohotkey-scripts/
  81. #Del::FileRecycleEmpty ; win + del
  82. return
  83. ; Always on Top
  84. ^SPACE:: Winset, Alwaysontop, , A ; ctrl + space
  85. Return
  86.  
  87. ; ================== MOUSE KEY MODIFIED ===================
  88. ;MButton::send, ^a
  89.  
  90. ; ======================= DESKTOP PROGRAM FOLDER ========================
  91. #IfWinActive, Prgrms ahk_exe explorer.exe
  92. $LButton::
  93.     WinGet, ID, ID, A
  94.     Click, 1
  95.     Send, {enter}
  96.     WinClose, ahk_id %ID%
  97. return
  98. #IfWinActive
  99.  
  100. #+d::run shell:desktop
  101. return
  102. ; ======================= FOLDER MIN MAX ========================
  103. #IfWinActive ahk_class CabinetWClass
  104. ]::
  105. send, #{up}
  106. return
  107. [::
  108. send, #{down}
  109. return
  110. /::
  111. send, #m
  112. return
  113. #IfWinActive
  114.  
  115. #+down::WinMinimize, A
  116. return
  117.  
  118. ; ================================== HIDE TASKBAR =====================================
  119. ; https://autohotkey.com/board/topic/83594-how-to-hide-taskbar-with-hotkey/
  120. #SingleInstance Force
  121.  
  122. #t:: ; Alt+T Hotkey
  123. WinExist("ahk_class Shell_TrayWnd")
  124. ControlGetPos,,,, hTB, ahk_class Shell_TrayWnd  ; Get Taskbar Height
  125. t := !t  ; Toggle Var (0 or 1)
  126.  
  127. VarSetCapacity(area, 16)
  128. WinGetActiveStats, AT, AW, AH, AX, AY  ; Get Active Window Stats
  129.  
  130. If (t = "1") ; Hide
  131. {  
  132.     Top := A_ScreenHeight
  133.     WinHide, ahk_class Shell_TrayWnd  ; Hide Taskbar
  134.     WinHide, Start ahk_class Button  ; Hide Start Button
  135.     WinMove, %AT%,,,0,, %A_ScreenHeight%  ; Increase Active Window's Height
  136. }
  137. Else ; Show
  138. {  
  139.     Top := A_ScreenHeight - hTB  ; Screen Height - Taskbar Height
  140.     WinShow, ahk_class Shell_TrayWnd  ; Show Taskbar
  141.     WinShow, Start ahk_class Button  ; Show Start Button
  142.     WinMove, %AT%,,,0,, (A_ScreenHeight-hTB)  ; Decrease Active Window's Height
  143. }
  144.  
  145. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 0, UInt,4, UInt,0)
  146. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 4, UInt,4, UInt,0)
  147. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 8, UInt,4, UInt,A_ScreenWidth)
  148. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 12,UInt,4, UInt,Top)
  149. DllCall("SystemParametersInfo", UInt,0x2F, UInt,0, UInt,&area, UInt,0)
  150. return
  151.  
  152. ; Hide task: http://hackerspace.kinja.com/another-late-ahk-script-that-hides-the-taskbar-1701996722
  153.  
  154. ; ============================ HIDE DESKTOP ICON =================================
  155. #h::
  156. MouseGetPos,,,win
  157. WinGetClass, class, ahk_id %win%
  158. If class in Progman,WorkerW
  159. {
  160.     ControlGet, HWND, Hwnd,, SysListView321, ahk_class Progman
  161.     If HWND =
  162.         ControlGet, HWND, Hwnd,, SysListView321, ahk_class WorkerW
  163.     If DllCall("IsWindowVisible", UInt, HWND)
  164.         WinHide, ahk_id %HWND%
  165.     Else
  166.         WinShow, ahk_id %HWND%
  167. }
  168. else
  169.     send, #h
  170. Return
  171. ;https://autohotkey.com/board/topic/40217-how-to-check-if-desktop-is-active/
  172. ;https://autohotkey.com/board/topic/46689-my-first-script-for-hidding-desktop-icons/
  173.  
  174. ; Double click
  175. ~LButton::
  176.  If ( A_PriorHotKey = A_ThisHotKey && A_TimeSincePriorHotkey < 400 ) {
  177.    WinGetClass, Class, A
  178.    If Class in Progman,WorkerW
  179.    var := (flag=0) ? "Show" : "Hide"
  180.    flag := !flag
  181.    Control,%var%,, SysListView321, ahk_class Progman
  182.    Control,%var%,, SysListView321, ahk_class WorkerW
  183. }
  184. Return
  185.  
  186. ;https://autohotkey.com/board/topic/38006-double-click-desktop-to-hide-icons/
  187. ;https://autohotkey.com/board/topic/38071-toggle-visibility-of-desktop-icons-by-doubleclicking-desktop/
  188.  
  189. ; =================== CREATE TXT ==========================
  190. #IfWinActive, ahk_class CabinetWClass
  191. ^+t:: ;If Windows+Shift+T is pressed in Windows Explorer
  192. Send !f ;> File
  193. Send w ;> New
  194. Send t ;select Text Document
  195. return
  196. #IfWinActive
  197.  
  198.  
  199. ; ================== CLOSE ALL WINDOWS ====================
  200. #F4::
  201. WinGet, id, list, , , Program Manager
  202. Loop, %id%
  203. {
  204.     StringTrimRight, this_id, id%a_index%, 0
  205.     WinGetTitle, this_title, ahk_id %this_id%
  206.     winclose,%this_title%
  207. }
  208. Return
  209.  
  210. ;=========== VIEW MODE =============
  211. #IfWinActive ahk_class CabinetWClass
  212. ; alt+3 large icons
  213. ; alt+7 detail
  214. !2::Send !v{down 2}{enter}
  215. !3::Send !v{down 3}{enter}
  216. !4::send !v{down 4}{enter}
  217. !6::Send !v{down 6}{enter}
  218. !7::Send !v{down 7}{enter}
  219. !8::send !v{down 8}{enter}
  220. #IfWinActive
  221.  
  222. ; ============= Ctrl Backspace ==============
  223. ; how to write scripts: http://www.autohotkey.com/docs/
  224.  
  225. #IfWinActive ahk_class CabinetWClass ; File Explorer
  226.     ^Bs::
  227. #IfWinActive, ahk_class Notepad
  228.     ^Bs::
  229.     Send ^+{Left}{Backspace}
  230.     return
  231. #IfWinActive
  232.  
  233. SetTitleMatchMode, 2
  234. #IfWinActive ahk_class XLMAIN
  235.     ^Bs::
  236.     Send ^+{Left}{BS}
  237.     return
  238. #IfWinActive
  239.  
  240. ; source and context: http://superuser.com/a/636973/124606
  241.  
  242. ; relevant documentation links:
  243. ; writing hotkeys
  244. ; http://www.autohotkey.com/docs/Hotkeys.htm
  245. ; list of key codes (including Backspace)
  246. ; http://www.autohotkey.com/docs/KeyList.htm
  247. ; the #IfWinActive directive
  248. ; http://www.autohotkey.com/docs/commands/_IfWinActive.htm
  249. ; the Send command
  250. ; http://www.autohotkey.com/docs/commands/Send.htm
  251.  
  252. ;__________________________________________________
  253.  
  254.  
  255. ; ============= WINDOWS EXIT =============
  256. ~esc::
  257. if (A_PriorHotkey <> "~esc" or A_TimeSincePriorHotkey > 400)
  258. {
  259.     KeyWait, Esc
  260.     return
  261. }
  262. send !{f4}
  263. return
  264.  
  265. ~End::
  266. if (A_PriorHotkey <> "~end" or A_TimeSincePriorHotkey > 400)
  267. {
  268.     KeyWait, End
  269.     return
  270. }
  271. else
  272. {
  273.     #IfWinActive ahk_class CabinetWClass
  274.     Send, ^w
  275.     return
  276.     #IfWinActive
  277.     Send, ^{f4}
  278.     return
  279. }
  280.  
  281. ~pause::winclose, a
  282. return
  283.  
  284. ; ============= RUN MENU ===============
  285. #appskey:: run notepad++
  286. return
  287.  
  288. ; ============= EXPLORER NAVIGATION ==============
  289. #IfWinactive ahk_class CabinetWClass
  290. #+n::
  291. Send ^e{Tab}
  292. Send {Down}ln
  293. return
  294. #IfWinactive,
  295.  
  296. ; ============= FUNCTIONS ==================
  297. ~F4::^v
  298. return
  299. ^F4::F4
  300. return
  301. ~F7::^+Tab
  302. return
  303. ~F8::^Tab
  304. return
  305. ~F9::send, #{down}
  306. return
  307. ~F10::send, #{up}
  308. return
  309. ~F12::browser_home
  310. return
  311. +F12::
  312. send, {F12}
  313. return
  314.  
  315. ; ---------- F3 Function -------------
  316. $F3::
  317. KeyWait, F3 ; wait for F3 released
  318. KeyWait, F3, D T0.2 ; wait 1 second for F3 pressed again
  319. If ErrorLevel ; if 1 second passes before F3 is pressed again
  320. {
  321.     Send ^c ; or whatever your copy code is
  322. }
  323. else ; we will now allow F3 to be pressed normally
  324. {
  325.     Loop
  326.     {
  327.         Send {F3 down}
  328.         KeyWait, F3 ; wait for F3 release
  329.         Send {F3 up}
  330.         KeyWait, F3, D T1 ; wait 1 second for F3 pressed again
  331.         If ErrorLevel ; if 1 second passes before F3 is pressed again
  332.            Break ; exit his Loop
  333.     }
  334. }
  335. return
  336.  
  337.  
  338. ; ------------ F2 function -------------
  339. ~Shift::
  340. if (A_PriorHotkey <> "~Shift" or A_TimeSincePriorHotkey > 400)
  341. {
  342.     ; Too much time between presses, so this isn't a double-press.
  343.     KeyWait, Shift
  344.     return
  345. }
  346. send {F2}
  347. return
  348.  
  349.  
  350. ; =========== POWER ===============
  351. #F5:: ;turn off monitor
  352. Sleep, 200
  353. SendMessage,0x112,0xF170,2,,Program Manager
  354. return
  355. #pause:: ;sleep
  356. DllCall("PowrProf\SetSuspendState", "int", 0, "int", 1, "int", 0)
  357. return
  358. !+End:: ;hibernate
  359. DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
  360. return
  361. #end:: ;shutdown
  362. shutdown, 1
  363. return
  364.  
  365.  
  366. ;============ RUN PROGRAMES ==============
  367. !+d::run idm514
  368. return
  369. !+g:: run chrome
  370. return
  371. !+h::run QQPYHandInput
  372. return
  373. !+l::run lingoes
  374. return
  375. ^!n::run notepad++
  376. return
  377. !+n:: run networks
  378. return
  379.  
  380.  
  381.  
  382. ; ========== Disable Hotkeys =============
  383. ^!s::
  384. suspend
  385. if (A_IsSuspended)
  386. {
  387.   TrayTip, Hotkey, Disabled, ,
  388. }
  389. else
  390. {
  391.   TrayTip, Hotkey, Enabled, ,
  392. }
  393. return
  394.  
  395. ^!p::pause
  396. return
  397.  
  398. ^!r::reload
  399. return
  400.  
  401. ^!e::edit
  402. return
  403.  
  404. ; ============= WINHOTKEYS ==================
  405. #c::run calc
  406. return
  407. #g::run http://translate.google.com/
  408. #i::run iexplore
  409. return
  410. #j::run shell:Downloads
  411. return
  412. #o::run D:\USB
  413. return
  414. #s:: run devenv
  415. return
  416. #w::run winword
  417. return
  418. #v::run sndvol
  419. return
  420. #x::run excel
  421. return
  422. #n::run notepad
  423. return
  424.  
  425.  
  426. ;============== VOLUME ==================
  427. !wheelup::
  428. send {volume_up 10}
  429. return
  430. !wheeldown::
  431. send {volume_down 10}
  432. return
  433. !numpaddiv::
  434. soundset +10
  435. return
  436. !numpadmult::
  437. soundset -10
  438. return
  439.  
  440. ~PrintScreen::
  441. if (A_PriorHotkey <> "~PrintScreen" or A_TimeSincePriorHotkey > 400)
  442. {
  443.     ; Too much time between presses, so this isn't a double-press.
  444.     KeyWait, PrintScreen
  445.     return
  446. }
  447. send {Volume_Mute}
  448. return
  449.  
  450. ; ============ MOUSE WHELL VOLUME ===================
  451. ~WheelUp::mouseWheelVolume("+10")
  452. ~WheelDown::mouseWheelVolume("-10")
  453. mouseWheelVolume(step)
  454. {  mouseGetPos,mx,my,wnd
  455.    wingetClass,cls,ahk_id %wnd%
  456.    if cls=Shell_TrayWnd
  457.    {  SoundSet %step%
  458.       soundSet 0,,mute
  459.       soundGet vol
  460.       ifInString,vol,.
  461.          stringMid,vol,vol,1,% inStr(vol,".")-1
  462.       tooltip, Volume:%vol%`%,% mx+8,% my+8,19
  463.       setTimer removeVolumeTip,2000
  464.    }
  465.    return
  466. removeVolumeTip:
  467.   tooltip,,,,19
  468.    settimer removeVolumeTip,OFF
  469.    return
  470. }
  471.  
  472.  
  473. ; ============= MEDIA ==================
  474. !pgdn::
  475. send, {media_next}
  476. return
  477. !pgup::
  478. send, {media_prev}
  479. return
  480. +pause::
  481. send {media_stop}
  482. return
  483. +volume_down::Volume_Mute
  484. return
  485. ; ~printscreen::
  486.  ;GetKeyState, state, ScrollLock, T ; state will be 'D' if ScrollLock is on or 'U' if it is off
  487. ;   if ( state = "U" )
  488. ;   send {volume_mute}
  489. ;return
Advertisement
Add Comment
Please, Sign In to add comment