Advertisement
ArchiveGuy

AutoHotkey Examples

Mar 2nd, 2014
7,597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ====================================
  2. ;        AUTO-EXECUTE ON LAUNCH
  3. ; ====================================
  4. ; ------------------------------------
  5. ;          SETUP KEYBIND GROUPS
  6.  
  7. ; #include F:\Documents\Documents\AHK-ViGEm-Bus\AHK-ViGEm-Bus.ahk
  8. SetTitleMatchMode, 3
  9.  
  10. ; VN Standard Keybinds:
  11.  
  12. ; Up Arrow: Scroll Wheel Up
  13. ; Down Arrow: Enter
  14. ; Left Arrow: Spacebar
  15. ; Right Arrow: Scroll Wheel Down
  16. ; Spacebar: Right Click
  17. ; Middle Click: Hide Mouse Cursor (Requires Borderless Gaming)
  18. GroupAdd, VNStandard, A Sky Full of Stars
  19. GroupAdd, VNStandard, Aokana
  20. GroupAdd, VNStandard, BALDR FORCE SE
  21. GroupAdd, VNStandard, BALDR SKY (18+ Patch)
  22. GroupAdd, VNStandard, 大番長 - System4.0 Ver.1.31 ; Big Bang Age
  23. GroupAdd, VNStandard, Bishoujo Mangekyou -Norowareshi Densetsu no Shoujo-
  24. GroupAdd, VNStandard, CHAOS;HEAD English RC2
  25. GroupAdd, VNStandard, Cartagra
  26. GroupAdd, VNStandard, ahk_exe cmvs64.exe ; Chrono Clock, Hapymaher
  27. GroupAdd, VNStandard, Da Capo 3 R
  28. GroupAdd, VNStandard, Daitoshokan no Hitsujikai
  29. GroupAdd, VNStandard, Dies irae ~Amantes amentes~
  30. GroupAdd, VNStandard, DRACU-RIOT!
  31. GroupAdd, VNStandard, euphoria
  32. GroupAdd, VNStandard, Evenicle
  33. GroupAdd, VNStandard, FATAL TWELVE
  34. GroupAdd, VNStandard, Funbag Fantasy
  35. GroupAdd, VNStandard, ahk_exe fureraba.exe ; Fureraba
  36. GroupAdd, VNStandard, ahk_exe SiglusEngine.exe ; Hatsukoi 1/1, HoshiOri
  37. GroupAdd, VNStandard, ahk_exe HGB.exe ; Hello, Goodbye
  38. GroupAdd, VNStandard, ISLAND
  39. GroupAdd, VNStandard, KARANOSHOJO
  40. GroupAdd, VNStandard, Kindred Spirits on the Roof
  41. GroupAdd, VNStandard, 恋色空模様 ; Koiiro Soramoyou
  42. GroupAdd, VNStandard, Magical Marriage Lunatics!!
  43. GroupAdd, VNStandard, Maitetsu
  44. GroupAdd, VNStandard, Momoiro Closet
  45. GroupAdd, VNStandard, ahk_exe mon_que.exe ; Monster Girl Quest! Final Chapter
  46. GroupAdd, VNStandard, Newton and the Apple Tree
  47. GroupAdd, VNStandard, レイジングループ ; Raging Loop
  48. GroupAdd, VNStandard, Re;Lord -The witch of Herfort and stuffed animals- Ver1.00
  49. GroupAdd, VNStandard, Sabbat of the Witch
  50. GroupAdd, VNStandard, Saku Saku: Love Blooms with the Cherry Blossoms (patch)
  51. GroupAdd, VNStandard, Sakura Sakura
  52. GroupAdd, VNStandard, Seinarukana
  53. GroupAdd, VNStandard, Sengoku Rance
  54. GroupAdd, VNStandard, Senren*Banka - A Thousand Colors Of Love -
  55. GroupAdd, VNStandard, Sorcery Jokers
  56. GroupAdd, VNStandard, Steins;Gate Linear Bounded Phenogram (English)
  57. GroupAdd, VNStandard, Tenioha! -Girls Can Be Pervy Too!-
  58. GroupAdd, VNStandard, The Ditzy Demons Are In Love With Me (18+ DLC)
  59. GroupAdd, VNStandard, The Fruit of Grisaia Unrated Version
  60. GroupAdd, VNStandard, Tokyo Babel
  61. GroupAdd, VNStandard, Tsujidou-san no Jun'ai Road
  62. GroupAdd, VNStandard, Ultimate Boob Wars!! ~Big Breasts vs Flat Chests~
  63. GroupAdd, VNStandard, Utawarerumono
  64. GroupAdd, VNStandard, VenusBlood FRONTIER International Eng Ver.
  65. GroupAdd, VNStandard, Wagamama High Spec
  66. GroupAdd, VNStandard, Wonderful Everyday
  67.  
  68. ; Modified VN Keybinds:
  69.  
  70. ; Use Page Up/Down as Up/Right Arrow
  71. GroupAdd, VNAltPgUpDown, FATAL TWELVE
  72. GroupAdd, VNAltPgUpDown, Sorcery Jokers
  73. GroupAdd, VNAltPgUpDown, Utawarerumono
  74.  
  75. ; Use Right Click as Left Arrow
  76. GroupAdd, VNAltRightClick, Aokana
  77. GroupAdd, VNAltRightClick, BALDR SKY (18+ Patch)
  78. GroupAdd, VNAltRightClick, Bishoujo Mangekyou -Norowareshi Densetsu no Shoujo-
  79. GroupAdd, VNAltRightClick, ahk_exe cmvs64.exe ; Chrono Clock, Hapymaher
  80. GroupAdd, VNAltRightClick, Daitoshokan no Hitsujikai
  81. GroupAdd, VNAltRightClick, DRACU-RIOT!
  82. GroupAdd, VNAltRightClick, euphoria
  83. GroupAdd, VNAltRightClick, ahk_exe HGB.exe ; Hello, Goodbye
  84. GroupAdd, VNAltRightClick, KARANOSHOJO
  85. GroupAdd, VNAltRightClick, Maitetsu
  86. GroupAdd, VNAltRightClick, Momoiro Closet
  87. GroupAdd, VNAltRightClick, Sabbat of the Witch
  88. GroupAdd, VNAltRightClick, Saku Saku: Love Blooms with the Cherry Blossoms (patch)
  89. GroupAdd, VNAltRightClick, Sengoku Rance
  90. GroupAdd, VNAltRightClick, Senren*Banka - A Thousand Colors Of Love -
  91. GroupAdd, VNAltRightClick, The Ditzy Demons Are In Love With Me (18+ DLC)
  92. GroupAdd, VNAltRightClick, Tsujidou-san no Jun'ai Road
  93. GroupAdd, VNAltRightClick, Ultimate Boob Wars!! ~Big Breasts vs Flat Chests~
  94. GroupAdd, VNAltRightClick, Utawarerumono
  95. GroupAdd, VNAltRightClick, VenusBlood FRONTIER International Eng Ver.
  96.  
  97. ; Use Shift as Left Arrow
  98. GroupAdd, VNAltShift, Kindred Spirits on the Roof
  99. GroupAdd, VNAltShift, Seinarukana
  100.  
  101. ; Use Mid Click as Left Arrow
  102. GroupAdd, VNAltMidClick, Steins;Gate Linear Bounded Phenogram (English)
  103.  
  104. ; Use Escape as Left Arrow
  105. GroupAdd, VNAltEscape, レイジングループ ; Raging Loop
  106. GroupAdd, VNAltEscape, Wonderful Everyday
  107.  
  108. ; Use H as Left Arrow
  109. GroupAdd, VNAltH, FATAL TWELVE
  110.  
  111. ; Alt-tab out and back into window before taking screenshot
  112. GroupAdd, VNTabOutSS, FATAL TWELVE
  113. ; ------------------------------------
  114. ;          SETUP OTHER GROUPS
  115.  
  116. GroupAdd, Desktop, ahk_class Progman
  117. GroupAdd, Desktop, ahk_class RDIconWnd
  118. GroupAdd, Desktop, ahk_class ROCKETDOCK
  119. GroupAdd, Desktop, ahk_class Shell_TrayWnd
  120. GroupAdd, Desktop, ahk_class WorkerW
  121. ; ------------------------------------
  122. ;         SET GLOBAL VARIABLES
  123.  
  124. ; Script execution variables
  125. EnableShellHook := false
  126.  
  127. ; OS related variables
  128. OsVersion := ((r := DllCall("GetVersion") & 0xFFFF) & 0xFF) "." (r >> 8)
  129. OsWin7OrLower := (OsVersion <= 6.1)
  130. NativeResX := 2560
  131. NativeResY := 1440
  132.  
  133. ; Path related variables
  134. PCSX2Folder = E:\Programs\Games\Emulators\PCSX2
  135. ScreenshotFolder = F:\Pictures\Screenshots
  136. ScriptsFolder = C:\Programs\Applications\Misc Scripts
  137. ShortcutsFolder = C:\Shortcuts
  138.  
  139. ; Firefox related variables
  140. TabChangeDelay := 300
  141. ; ------------------------------------
  142. ;      EXECUTE ON-LAUNCH SCRIPTS
  143.  
  144. ; Setup hotkeys to pass alphabetic keys on desktop through to run dialog
  145. Alphabet = "abcdefghijklmnopqrstuvwxyz"
  146. Hotkey, IfWinActive, ahk_group Desktop
  147. Loop % StrLen(Alphabet)
  148. {
  149.     c1 := SubStr(Alphabet, A_Index, 1)
  150.     Hotkey, %c1%, RunPassthrough    
  151. }
  152.  
  153. ; Setup shell hook
  154. If (EnableShellHook) {
  155.     Gui +LastFound
  156.     DllCall("RegisterShellHookWindow", UInt, WinExist())
  157.     MsgNum := DllCall("RegisterWindowMessage", Str, "SHELLHOOK")
  158.     OnMessage(MsgNum, "ShellMessage")
  159. }
  160. ; ------------------------------------
  161. Return
  162. ; ====================================
  163. ;          SUBROUTINE LABELS
  164. ; ====================================
  165.  
  166. ; Close process on delay
  167. CloseOnDelay:
  168.     WinClose ahk_exe %ToClose%
  169.     CloseTimerActive = 0
  170. Return
  171.  
  172. ; GTA V dance loop
  173. ; GTADance:
  174. ;   IfWinExist, ahk_exe GTA5.exe
  175. ;   {
  176. ;       GTAController.SetButtonState(0,true)
  177. ;       GTAController.SendReport()
  178. ;       Sleep 60
  179. ;       GTAController.SetButtonState(0,false)
  180. ;       GTAController.SendReport()
  181. ;   }
  182. ;   else {
  183. ;       MsgBox GTA 5 window not focused.  Ending dance loop.
  184. ;       GTADanceOn = 0
  185. ;       SetTimer, GTADance, Delete
  186. ;   }
  187. ; Return
  188.  
  189. ; GTA V idle-avoiding loop
  190. GTAIdle:
  191.     IfWinExist, ahk_exe GTA5.exe
  192.     {
  193.         SetKeyDelay, 60, 60
  194.         IfWinExist, A
  195.         {
  196.             WinActivate, ahk_exe GTA5.exe
  197.             Send, {w down}{s down}
  198.             Sleep 100
  199.             Send, {w up}{s up} 
  200.             WinActivate
  201.         }
  202.     }
  203.     else {
  204.         MsgBox GTA 5 window not detected.  Ending anti-idle loop.
  205.         GTAIdleOn = 0
  206.         SetTimer, GTAIdle, Delete
  207.     }
  208. Return
  209.  
  210. ; Take screenshots with NirCMD
  211. NircmdSS:
  212.     If (ScreenshotIndex < 1) {
  213.         Loop, %ScreenshotFolder%\*
  214.         {
  215.              FileGetTime, Time, %A_LoopFileFullPath%, C
  216.              If (Time > Time_Orig) {
  217.                   Time_Orig := Time
  218.                   NewIndexFile := A_LoopFileName
  219.              }
  220.         }
  221.         Loop, Parse, NewIndexFile, (|)
  222.             If (A_LoopField is integer)
  223.                 NewIndexNum := A_LoopField
  224.         ScreenshotIndex := NewIndexNum
  225.         MsgBox, Screenshot indexing complete.  Repeat hotkey to take screenshot.
  226.     }
  227.     Else {
  228.         Run nircmd savescreenshot "%ScreenshotFolder%\Screenshot (%ScreenshotIndex%).png"
  229.         SoundPlay, *64
  230.     }
  231.     ScreenshotIndex++
  232. Return
  233.  
  234. ; Pass alphabetic keys on desktop to run dialog (temporarily disable with Scroll Lock)
  235. RunPassthrough:
  236.     If (!GetKeyState("ScrollLock", "T")) {
  237.         SetKeyDelay, -1, 1
  238.         Send #r
  239.         Sleep 30
  240.         Send %A_ThisHotkey%
  241.     }
  242.     Else
  243.         Send %A_ThisHotkey%
  244. Return
  245. ; ------------------------------------
  246. ; ====================================
  247. ;        FUNCTION DEFINITIONS
  248. ; ====================================
  249.  
  250. ; Process messages from shell hook
  251. ; ShellMessage(wParam, lParam)
  252. ; {
  253. ;   If (wParam = 32772 or wParam = 4) { ; HSHELL_RUDEAPPACTIVATED = 32772, HSHELL_WINDOWACTIVATED = 4
  254. ;       WinGet, FocusedApp, ProcessName, "ahk_id %lParam%"
  255. ;       Msgbox, Now focused: %FocusedApp%
  256. ;   }
  257. ; }
  258. ; ------------------------------------
  259. ; ====================================
  260. ;           GLOBAL HOTKEYS
  261. ; ====================================
  262.  
  263. ; Volume Up/Down increment one step at a time
  264. ^Volume_Down::SoundSet, -1
  265. ^Volume_Up::SoundSet, +1
  266.  
  267. ; Mute affects only focused window
  268. Volume_Mute::Run nircmd muteappvolume focused 2
  269.  
  270. ; FeedDemon (Win+F10)
  271. #F10::Run "C:\Program Files (x86)\FeedDemon\FeedDemon.exe"
  272.  
  273. ; Daemon Tools (Win+F9)
  274. #F9::Run "C:\Program Files\DAEMON Tools Lite\DTLite.exe"
  275.  
  276. ; JDownloader (Win+F8)
  277. #F8::Run "C:\Programs\Applications\JDownloader v2.0\JDownloader2.exe"
  278.  
  279. ; Open Window Spy (Win+F7)
  280. #F7::Run "C:\Program Files\AutoHotkey\AU3_Spy.exe"
  281.  
  282. ; Edit This Script (Win+F6)
  283. #F6::Run "C:\Program Files (x86)\Notepad++\notepad++.exe" -openSession "F:\Documents\Documents\AutoHotkey.npp"
  284.  
  285. ; Reload This Script (Win+F5)
  286. #F5::Reload
  287.  
  288. ; Edit Firefox Start Page (Win+F4)
  289. #F4::Run "C:\Program Files (x86)\Notepad++\notepad++.exe" "E:\Dropbox\Program Data\Firefox Startpage\newtab.html"
  290.  
  291. ; Run Borderless Gaming (Win+F3)
  292. #F3::
  293. DetectHiddenWindows, On
  294. IfWinNotExist ahk_exe BorderlessGaming.exe
  295.     Run "C:\Program Files (x86)\Borderless Gaming\BorderlessGaming.exe"
  296. else
  297.     WinActivate
  298. Return
  299.  
  300. ; Show/Hide Taskbar (Win+A)
  301. #a::
  302. If (TaskbarHidden = 1) {
  303.     WinShow, ahk_class Shell_TrayWnd
  304.     TaskbarHidden = 0
  305. }
  306. else {
  307.     WinHide, ahk_class Shell_TrayWnd
  308.     TaskbarHidden = 1
  309. }
  310. Return
  311.  
  312. ; Take screenshots in folder by app name with Win+PrtSc
  313. ; #PrintScreen::
  314. ; WinGet, TargetPath, ProcessPath, A
  315. ; SplitPath, TargetPath,,,, CurrentApp
  316. ; SSDest = %ScreenshotFolder%\%CurrentApp%
  317. ; If (!FileExist(SSDest))
  318. ;   FileCreateDir %SSDest%
  319. ; Run nircmd savescreenshot "%SSDest%\%A_Now%.png"
  320. ; Return
  321.  
  322. ; Open Shortcuts Folder (Ctrl+Win+S)
  323. ^#s::Run explore %ShortcutsFolder%
  324.  
  325. ; Create Shortcut of Current Application (Win+S)
  326. #s::
  327. If (!WinActive("ahk_exe explorer.exe")) {
  328.     WinGet, TargetPath, ProcessPath, A
  329.     SplitPath, TargetPath,, TargetDir
  330.     InputBox, ShortcutName, New Shortcut, A new shortcut will be created for the file:`r`r%TargetPath%`r`rwith the name:
  331.     ShortcutName = %ShortcutName%
  332.     If (!ErrorLevel && ShortcutName) {
  333.         SetWorkingDir, %ShortcutsFolder%
  334.         FileCreateShortcut, %TargetPath%, %ShortcutName%.lnk, %TargetDir%
  335.         MsgBox Shortcut created for %ShortcutName%.
  336.     }
  337. }
  338. else
  339.     Send #s
  340. Return
  341.  
  342. ; Reopen Logitech Gaming Software (Win+RMB)
  343. ; #RButton::
  344. ; Process, Close, LCore.exe
  345. ; Run "C:\Program Files\Logitech Gaming Software\LCore.exe"
  346. ; Return
  347.  
  348. ; Hidden Files toggle (Win+H)
  349. #h::
  350. RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
  351. If (HiddenFiles_Status = 2) {
  352.     RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
  353.     RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowSuperHidden, 1
  354. }
  355. else {
  356.     RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
  357.     RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowSuperHidden, 0
  358. }
  359. Send {F5}
  360. Return
  361.  
  362. ; Minimize Active Window (Win+N)
  363. #n::WinMinimize, A
  364.  
  365. ; Copy Current Window Unique ID to Clipboard (Win+Del)
  366. #Del::
  367. WinGet, getId, ID, A
  368. Clipboard = %getId%
  369. Return
  370.  
  371. ; Print Current Window Class and copy to Clipboard (Win+Z)
  372. #z::
  373. WinGetClass, CurrentClass, A
  374. MsgBox Current window is %CurrentClass%
  375. Clipboard = %CurrentClass%
  376. Return
  377.  
  378. ; Put PC to sleep (Win+Pause)
  379. #Pause::DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
  380.  
  381. ; Temporarily Suspend All Hotkeys (Shift+Pause)
  382. +Pause::Suspend
  383.  
  384. ; Exit AutoHotkey (Alt+Pause)
  385. !Pause::ExitApp
  386.  
  387. ; Use RAlt+\ as Alt+Tab
  388. >!\::>!Tab
  389.  
  390. ; Toggle screen resolution (Win+`)
  391. #`::
  392. If (A_ScreenWidth == NativeResX && A_ScreenHeight == NativeResY)
  393.     Run "%ScriptsFolder%\LastUsedResolution.bat"
  394. Else
  395.     Run nircmd setdisplay %NativeResX% %NativeResY% 32
  396. Return
  397.  
  398. ; Switch monitors (Shift+Win+`)
  399. +#`::
  400. If (A_ScreenWidth == NativeResX && A_ScreenHeight == NativeResY)
  401.     Run displayswitch.exe /external
  402. Else
  403.     Run displayswitch.exe /internal
  404. Return
  405.  
  406. ; Open apps from tray (Shift+Win+1-6)
  407. +#6::
  408. TrayApp++
  409. +#5::
  410. TrayApp++
  411. +#4::
  412. TrayApp++
  413. +#3::
  414. TrayApp++
  415. +#2::
  416. TrayApp++
  417. +#1::
  418. TrayApp++
  419. CoordMode, Mouse, Screen
  420. MouseGetPos, xOld, yOld
  421. Send #b{Right %TrayApp%}{Enter}
  422. MouseGetPos, xNew, yNew
  423. If (xOld == xNew and yOld == yNew)
  424.     Send #b{Right %TrayApp%}{AppsKey}{Enter}{Enter}
  425. TrayApp := 0
  426. Return
  427.  
  428. ; Refresh Focus (Win+-)
  429. #-::
  430. IfWinExist, A
  431. {
  432.     WinActivate, ahk_class Shell_TrayWnd
  433.     WinActivate
  434. }
  435. Return
  436.  
  437. ; Close current app after delay (Ctrl+Alt+End)
  438. ^!End::
  439.     If !CloseTimerActive {
  440.         WinGet, ToClose, ProcessName, A
  441.         InputBox, CloseDelay, Closing Program, %ToClose% will be closed after the specified delay in seconds.  Repeat hotkey to cancel.
  442.         CloseSeconds := CloseDelay * -1000
  443.         If (!ErrorLevel && CloseSeconds) {
  444.             SetTimer, CloseOnDelay, %CloseSeconds%
  445.             CloseTimerActive = 1
  446.             MsgBox Closing in %CloseDelay% seconds.
  447.         }
  448.     }
  449.     Else {
  450.         SetTimer, CloseOnDelay, Delete
  451.         CloseTimerActive = 0
  452.         MsgBox Cancelling close on delay for %ToClose%.
  453.     }
  454. Return
  455.  
  456. ; Remap Win+\ to Win+R (Workaround for mouse profiles)
  457. #\::Send #r
  458.  
  459. ; Block Alt+Left Arrow (Workaround for UAC Macro)
  460. !Left::Return
  461.  
  462. ; Launch KeePass if not already running (Ctrl+Alt+K)
  463. $^!k::
  464. DetectHiddenWindows, On
  465. IfWinNotExist ahk_exe KeePass.exe
  466.     Run "C:\Program Files (x86)\KeePass Password Safe 2\KeePass.exe"
  467. else
  468.     Send ^!k
  469. Return
  470. ; ------------------------------------
  471. ; ====================================
  472. ;       PROGRAM-SPECIFIC HOTKEYS
  473. ; ====================================
  474. ; ------------------------------------
  475. ;         TEMPORARY HOTKEYS
  476.  
  477. ; Empty
  478. ; ------------------------------------
  479. ;         INDIVIDUAL HOTKEYS
  480.  
  481. ; Media Player Classic keybinds
  482. ; #IfWinActive ahk_class MediaPlayerClassicW
  483. ; RButton & Volume_Down::SoundSet, -1
  484. ; RButton & Volume_Up::SoundSet, +1
  485. ; RButton & XButton1::Send ^{PgUp}
  486. ; RButton & XButton2::Send ^{PgDn}
  487. ; RButton & WheelDown::Send {Left}
  488. ; RButton & WheelUp::Send {Right}
  489. ; RButton & MButton::Reload
  490.  
  491. ; Firefox keybinds
  492. #IfWinActive ahk_exe firefox.exe
  493. ;     Close tab with Alt+F4
  494. !F4::Send ^w
  495. ;     Open tab with Win+Up
  496. #Up::Send ^t
  497. ;     Reopen closed tab with Win+\ (For mouse macro)
  498. #\::Send +^t
  499. ;     Refresh page with Win+- (On 4chan refresh thread/catalog)
  500. #-::
  501. SetTitleMatchMode, 2
  502. If (WinActive("4chan - Firefox Developer Edition"))
  503.     Send z
  504. Else
  505.     Send {F5}
  506. Return
  507. ;     Open bookmarks with Win+` (or refresh watcher on 4chan)
  508. #`::
  509. SetTitleMatchMode, 2
  510. If (WinActive("4chan - Firefox Developer Edition"))
  511.     Send +r
  512. Else
  513.     Send ^b
  514. Return
  515. ;     Left before enter on .exe dialogs
  516. !Left::
  517. SetTitleMatchMode, RegEx
  518. If (WinActive("Opening .*\.exe"))
  519.     Send {Left}
  520. Return
  521. ;     Fix for accidental tab change after closing/opening tab on mouse
  522. ^Tab::
  523. +^Tab::
  524. If (A_TimeSincePriorHotkey > TabChangeDelay or A_PriorHotkey == "^Tab" or A_PriorHotkey == "+^Tab" or A_TimeSincePriorHotkey == -1)
  525.     If (A_ThisHotkey == "^Tab")
  526.         Send ^{Tab}
  527.     Else
  528.         Send +^{Tab}
  529. Return
  530.  
  531. ; File explorer keybinds
  532. #IfWinActive ahk_class CabinetWClass
  533. ;     Open file location (Win+V)
  534. #v::Send {AppsKey}i
  535. ;     Extract File/Folder to Temp folder (Win+E)
  536. #e::
  537. ClipBuffer := Clipboard
  538. Send ^c
  539. If (FileExist(Clipboard)) {
  540.     SplitPath, Clipboard,,,, ArchName, ArchDrive
  541.     ExtractPath = %ArchDrive%\Temp\%ArchName%\
  542.     Run %ComSpec% /c "7z x "%Clipboard%" -o"%ExtractPath%" & pause & explorer "%ExtractPath%""
  543. }
  544. Clipboard := ClipBuffer
  545. Return
  546.  
  547. ; Thunderbird keybinds
  548. #IfWinActive ahk_exe thunderbird.exe
  549. ;     Navigate unread messages with mouse back/forward buttons
  550. XButton2::n
  551. XButton1::[
  552.  
  553. ; Bluestacks keybinds
  554. #IfWinActive ahk_exe BlueStacks.exe
  555. ;     Send security password
  556. :*:@s::
  557. If (!BSPassword) {
  558.     InputBox, BSPassword, Enter Password, ROM Security Password not yet entered.  Please enter password:
  559. }
  560. Else {
  561.     SendInput %BSPassword%
  562. }
  563. Return
  564.  
  565. ; PCSX2 keybinds
  566. #IfWinActive ahk_exe pcsx2.exe
  567. ;     Toggle PCSX2 graphic settings then trigger GSdx refresh (Mouse back button)
  568. XButton1::
  569. SetWorkingDir, %PCSX2Folder%\inis
  570. If FileExist("GSdx_2.ini") {
  571.     FileMove, GSdx.ini, GSdx_1.ini
  572.     FileMove, GSdx_2.ini, GSdx.ini
  573. }
  574. Else If FileExist("GSdx_1.ini") {
  575.     FileMove, GSdx.ini, GSdx_2.ini
  576.     FileMove, GSdx_1.ini, GSdx.ini
  577. }
  578. SetKeyDelay, 200, 20
  579. Send {F9}{F9}
  580. Return
  581. ;     Refresh GSdx on bottom right mouse button
  582. MButton::
  583. SetKeyDelay, 200, 20
  584. Send {F9}{F9}
  585. Return
  586.  
  587. ; GTA V keybinds
  588. #IfWinActive ahk_exe GTA5.exe
  589. ;     Connection switches
  590. ScrollLock::
  591. Run "%ScriptsFolder%\GTA V\Toggle GTAV Solo.lnk"
  592. SoundPlay *64
  593. Return
  594. End::
  595. Run "%ScriptsFolder%\GTA V\GTAV Emergency DC.lnk"
  596. SoundPlay *16
  597. Return
  598. ;     Dance loop (ctrl+shift+D)
  599. ; +^d::
  600. ; If GTADanceOn {
  601. ;   GTADanceOn = 0
  602. ;   SetTimer, GTADance, Delete
  603. ;   MsgBox Disabling dance loop.
  604. ; }
  605. ; else {
  606. ;   MsgBox Enabling dance loop.
  607. ;   If (!GTAController)
  608. ;       GTAController := new ViGEmXb360()
  609. ;   GTADanceOn = 1 
  610. ;   SetTimer, GTADance, 476
  611. ; }
  612. ;Return
  613. ;     Idle avoiding loop (ctrl+shift+I)
  614. +^i::
  615. If GTAIdleOn {
  616.     MsgBox Disabling anti-idle loop.
  617.     GTAIdleOn = 0
  618.     SetTimer, GTAIdle, Delete
  619. }
  620. else {
  621.     MsgBox Enabling anti-idle loop.
  622.     GTAIdleOn = 1  
  623.     SetTimer, GTAIdle, 420000
  624. }
  625. Return
  626. ;     Toggle expanded radar (shift+Z)
  627. +z::
  628. SetKeyDelay, 100, 60
  629. Send {Esc}
  630. Sleep 100
  631. Send {Right 4}
  632. Sleep 300
  633. Send {Enter}
  634. Sleep 300
  635. Send {Down 5}{Enter}
  636. Sleep 100
  637. Send {Down 5}{Enter}
  638. Sleep 100
  639. Send {Backspace 3}
  640. Return
  641. ;     Launch Chopper Tail (ctrl+shift+C)
  642. +^c::
  643. SetKeyDelay, 100, 60
  644. Send {Esc}
  645. Sleep 100
  646. Send {Right}
  647. Sleep 300
  648. Send {Enter}
  649. Sleep 300
  650. Send {Enter}
  651. Sleep 100
  652. Send {Down}{Enter}
  653. Sleep 100
  654. Send {Up 2}{Enter}
  655. Sleep 100
  656. Send {Up 5}{Enter}
  657. Sleep 200
  658. Send {Down 15}{Enter}{Enter}
  659. Return
  660. ;     Disable Windows key (seems to get glitched when alt-tabbing in/out frequently)
  661. LWin::
  662. RWin::
  663. Return
  664. ;     Bob up/down (Alt+C then hold C)
  665. !c::
  666. While (GetKeyState("c","P"))
  667. {
  668.     Send {Ctrl Down}
  669.     Sleep 600
  670.     Send {Ctrl Up}
  671.     Send {Shift Down}
  672.     Sleep 550
  673.     Send {Shift Up}
  674. }
  675.  
  676. ; Tab advances to next word in inline autocomplete (Run dialog)
  677. #IfWinActive Run ahk_class #32770 ahk_exe explorer.exe
  678. Tab::
  679. ClipBuffer := Clipboard
  680. Send ^c
  681. NextWord := InStr(Clipboard, " ")
  682. Clipboard := SubStr(Clipboard, 1, NextWord ? NextWord - 1 : StrLen(Clipboard))
  683. Send ^v{Space}
  684. Clipboard := ClipBuffer
  685. Return
  686.  
  687. ; qBittorrent keybinds
  688. #IfWinActive ahk_class Qt5QWindowIcon
  689. ;     Save to last used location
  690. Home UP::Send {Tab 4}{Up 6}
  691. ;     Allow Alt+Left to accept dialogs
  692. !Left::Send {Left}
  693. ; ------------------------------------
  694. ;            HOTKEY GROUPS
  695.  
  696. ; VN Alternate Keybinds
  697.  
  698. #IfWinActive ahk_group VNAltPgUpDown
  699. Up::PgUp
  700. Right::PgDn
  701.  
  702. #IfWinActive ahk_group VNAltRightClick
  703. Left::RButton
  704. Space::Space
  705.  
  706. #IfWinActive ahk_group VNAltShift
  707. Left::Shift
  708. Space::Space
  709.  
  710. #IfWinActive ahk_group VNAltMidClick
  711. Left::MButton
  712. Space::Space
  713.  
  714. #IfWinActive ahk_group VNAltEscape
  715. Left::Esc
  716. Space::Space
  717.  
  718. #IfWinActive ahk_group VNAltH
  719. Left::h
  720. Space::Space
  721.  
  722. #IfWinActive ahk_group VNTabOutSS
  723. #PrintScreen::
  724. SetKeyDelay, 100, 60
  725. Send !{Tab}!{Tab}#{PrintScreen}
  726. Return
  727.  
  728. ; VN Standard Keybinds
  729. #IfWinActive ahk_group VNStandard
  730. Up::Send {WheelUp}
  731. Down::Enter
  732. Left::Space
  733. Right::Send {WheelDown}
  734. Space::RButton
  735. MButton::
  736. Send #{ScrollLock}
  737. Send {ScrollLock}
  738. Return
  739. ; ------------------------------------
  740. ; ====================================
  741. ;          OS-SPECIFIC HOTKEYS
  742. ; ====================================
  743. ; ------------------------------------
  744. ;          WINDOWS 7 OR OLDER
  745.  
  746. #If %OsWin7OrLower%
  747.  
  748. ; Take screenshots with nircmd (Win+Print Screen)
  749. #PrintScreen::Gosub NircmdSS
  750. ; ------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement