Last active
January 25, 2025 10:12
-
-
Save raveren/bac5196d2063665d2154 to your computer and use it in GitHub Desktop.
My personal autohotkey configuration (used and updated for 10+ years!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; ██╗███╗ ██╗██╗████████╗██╗ █████╗ ██╗ ██╗███████╗███████╗ | |
; ██║████╗ ██║██║╚══██╔══╝██║██╔══██╗██║ ██║╚══███╔╝██╔════╝ | |
; ██║██╔██╗ ██║██║ ██║ ██║███████║██║ ██║ ███╔╝ █████╗ | |
; ██║██║╚██╗██║██║ ██║ ██║██╔══██║██║ ██║ ███╔╝ ██╔══╝ | |
; ██║██║ ╚████║██║ ██║ ██║██║ ██║███████╗██║███████╗███████╗ | |
; ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚══════╝ | |
; | |
; https://gist.github.com/raveren/bac5196d2063665d2154/edit | |
; | |
; for ASCII art http://patorjk.com/software/taag/#f=ANSI%20Shadow | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
#NoTrayIcon | |
#SingleInstance | |
SetTitleMatchMode(2) ; 2 = A window's title can contain WinTitle anywhere inside it to be a match. | |
#Requires AutoHotkey v2.0 | |
; RunOnStartup() | |
;; run as admin was disabled as it breaks drag and drop onto AHK-launched apps | |
; SetWorkingDir %A_ScriptDir% | |
; if not A_IsAdmin | |
; Run *RunAs "%A_ScriptFullPath%" | |
; ██████╗ █████╗ ██╗███╗ ██╗███╗ ███╗███████╗████████╗███████╗██████╗ | |
; ██╔══██╗██╔══██╗██║████╗ ██║████╗ ████║██╔════╝╚══██╔══╝██╔════╝██╔══██╗ | |
; ██████╔╝███████║██║██╔██╗ ██║██╔████╔██║█████╗ ██║ █████╗ ██████╔╝ | |
; ██╔══██╗██╔══██║██║██║╚██╗██║██║╚██╔╝██║██╔══╝ ██║ ██╔══╝ ██╔══██╗ | |
; ██║ ██║██║ ██║██║██║ ╚████║██║ ╚═╝ ██║███████╗ ██║ ███████╗██║ ██║ | |
; ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; set taskbar transparent to use with https://github.com/alatsombath/Fountain-of-Colors | |
WinSetTransparent(195, "ahk_class Shell_TrayWnd") | |
; ███╗ ██╗██╗ ██╗███╗ ███╗██╗ ██████╗ ██████╗██╗ ██╗ | |
; ████╗ ██║██║ ██║████╗ ████║██║ ██╔═══██╗██╔════╝██║ ██╔╝ | |
; ██╔██╗ ██║██║ ██║██╔████╔██║██║ ██║ ██║██║ █████╔╝ | |
; ██║╚██╗██║██║ ██║██║╚██╔╝██║██║ ██║ ██║██║ ██╔═██╗ | |
; ██║ ╚████║╚██████╔╝██║ ╚═╝ ██║███████╗╚██████╔╝╚██████╗██║ ██╗ | |
; ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; use numpad always as numbers, reuse NumLock as language switch | |
; toggle disabled state if without numpad | |
; SetNumLockState("AlwaysOff") | |
SetNumLockState("AlwaysOn") | |
NumpadDot::. | |
NumLock::SendInput("{Alt down}{shift}{Alt up}") | |
; | |
; ███╗ ███╗ ██████╗ ██╗ ██╗███████╗███████╗ | |
; ████╗ ████║██╔═══██╗██║ ██║██╔════╝██╔════╝ | |
; ██╔████╔██║██║ ██║██║ ██║███████╗█████╗ | |
; ██║╚██╔╝██║██║ ██║██║ ██║╚════██║██╔══╝ | |
; ██║ ╚═╝ ██║╚██████╔╝╚██████╔╝███████║███████╗ | |
; ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝ | |
; | |
; Holding right or left button + press back/forward to switch tab | |
~RButton & XButton1::Send("^{Tab}") | |
~RButton & XButton2::Send("+^{Tab}") | |
~LButton & XButton1::Send("^{Tab}") | |
~LButton & XButton2::Send("+^{Tab}") | |
; Hold right+scroll = zoom in/out | |
RButton & WheelUp::Send("{CTRLDOWN}{NumpadSub}{CTRLUP}") | |
RButton & WheelDown::Send("{CTRLDOWN}{NumpadAdd}{CTRLUP}") | |
; ███████╗██████╗ ██████╗ ████████╗██╗███████╗██╗ ██╗ | |
; ██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║██╔════╝╚██╗ ██╔╝ | |
; ███████╗██████╔╝██║ ██║ ██║ ██║█████╗ ╚████╔╝ | |
; ╚════██║██╔═══╝ ██║ ██║ ██║ ██║██╔══╝ ╚██╔╝ | |
; ███████║██║ ╚██████╔╝ ██║ ██║██║ ██║ | |
; ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ | |
; | |
; nothing here works well.. | |
; #3:: | |
; { | |
; WinGet, active_id, ID, A | |
; Run, %A_AppData%\Spotify\Spotify.exe, , Hide | |
; WinActivate, ahk_id %active_id% | |
; Return | |
; } | |
; shift+volumeUp: Volume up | |
+Volume_Up:: | |
{ | |
if WinActive("ahk_exe spotify.exe") | |
{ | |
Send("`"^{Up}`"") | |
} | |
else | |
{ | |
spotifyHwnd := WinGetID("ahk_exe spotify.exe") | |
; Chromium ignores keys when it isn't focused. | |
; Focus the document window without bringing the app to the foreground. | |
ControlFocus("Chrome_RenderWidgetHostHWND1", "ahk_id " spotifyHwnd) | |
ControlSend("`"^{Up}`"", , "ahk_id " spotifyHwnd) | |
} | |
} | |
; shift+volumeDown: Volume down | |
+Volume_Down:: | |
{ | |
if WinActive("ahk_exe spotify.exe") | |
{ | |
Send("`"^{Down}`"") | |
} | |
else | |
{ | |
spotifyHwnd := WinGetID("ahk_exe spotify.exe") | |
; Chromium ignores keys when it isn't focused. | |
; Focus the document window without bringing the app to the foreground. | |
ControlFocus("Chrome_RenderWidgetHostHWND1", "ahk_id " spotifyHwnd) | |
ControlSend("`"^{Down}`"", , "ahk_id " spotifyHwnd) | |
} | |
} | |
; █████╗ ██╗ ████████╗ ██╗ ██████╗████████╗██████╗ ██╗ ██╗ ████████╗ | |
; ██╔══██╗██║ ╚══██╔══╝ ██║ ██╔════╝╚══██╔══╝██╔══██╗██║ ██║ ╚══██╔══╝ | |
; ███████║██║ ██║ ████████████╗ ██║ ██║ ██████╔╝██║ ████████████╗ ██║ | |
; ██╔══██║██║ ██║ ╚════██╔════╝ ██║ ██║ ██╔══██╗██║ ╚════██╔════╝ ██║ | |
; ██║ ██║███████╗██║ ██║ ╚██████╗ ██║ ██║ ██║███████╗ ██║ ██║ | |
; ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; alt+ctrl+T = toggle currnet window to be AlwaysOnTop | |
; will eventually be replaced by Windows PowerToys | |
^!T:: | |
{ | |
WinSetAlwaysontop(-1, "A") | |
Title := WinGetTitle("A") | |
; TraySetIcon("Menu Tray, Icon","Menu Tray, Icon","Menu Tray, Icon") | |
A_IconHidden := false | |
TrayTip("Always on top", "For window " Title) | |
SoundPlay(A_WinDir "\Media\notify.wav") ; beep even if alerts are off | |
Sleep(5000) ; Let it display for 5 seconds. | |
A_IconHidden := true | |
} | |
; ██████╗ █████╗ ██████╗ ███████╗██╗ ██████╗ ██████╗██╗ ██╗ | |
;██╔════╝██╔══██╗██╔══██╗██╔════╝██║ ██╔═══██╗██╔════╝██║ ██╔╝ | |
;██║ ███████║██████╔╝███████╗██║ ██║ ██║██║ █████╔╝ | |
;██║ ██╔══██║██╔═══╝ ╚════██║██║ ██║ ██║██║ ██╔═██╗ | |
;╚██████╗██║ ██║██║ ███████║███████╗╚██████╔╝╚██████╗██║ ██╗ | |
; ╚═════╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Capslock toggles between browser and PHPStorm. | |
Capslock:: | |
{ | |
; editor := "ahk_exe sublime_text.exe" | |
editor := "ahk_exe phpstorm64.exe" | |
browser := "ahk_exe firefox.exe" | |
; browser := "ahk_exe chrome.exe" | |
secondary_browser := "ahk_exe chrome.exe" | |
; secondary_editor := "ahk_exe sublime_text.exe" | |
if ( WinActive( secondary_browser ) ) | |
{ | |
if ( WinExist( browser ) ) { | |
WinActivate(browser, , "Developer Tools") | |
} | |
} else { | |
if ( WinActive( editor ) ) | |
{ | |
Send("^s") | |
} | |
if WinActive( browser ) | |
{ | |
if ( WinExist( editor ) ) { | |
SetTitleMatchMode("RegEx") | |
WinActivate(editor, , "^Terminal|^Git") | |
; Switches the active window's keyboard layout/language to English (US). | |
PostMessage 0x0050, 0, 0x4090409,, "A" ; | |
SetTitleMatchMode(2) | |
} | |
} else { | |
if ( WinExist( browser ) ) { | |
WinActivate(browser, , "Developer Tools") | |
} else { | |
if ( WinExist( secondary_browser ) ) { | |
WinActivate(secondary_browser) | |
} else { | |
Run("firefox") | |
} | |
} | |
} | |
} | |
} | |
; ███████╗██╗ ██╗██╗███████╗████████╗ ██╗ ██████╗ █████╗ ██████╗ ███████╗ | |
; ██╔════╝██║ ██║██║██╔════╝╚══██╔══╝ ██║ ██╔════╝██╔══██╗██╔══██╗██╔════╝ | |
; ███████╗███████║██║█████╗ ██║ ████████████╗ ██║ ███████║██████╔╝███████╗ | |
; ╚════██║██╔══██║██║██╔══╝ ██║ ╚════██╔════╝ ██║ ██╔══██║██╔═══╝ ╚════██║ | |
; ███████║██║ ██║██║██║ ██║ ██║ ╚██████╗██║ ██║██║ ███████║ | |
; ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Shift+Capslock toggles between windows of active app (like different firefox windows) | |
+Capslock:: | |
{ | |
ActiveApp := WinGetProcessName("A") | |
WinActivateBottom("ahk_exe " . ActiveApp) | |
} | |
; ██████╗████████╗██████╗ ██╗ ██╗ █████╗ ██╗ ████████╗ ██╗ ██████╗ | |
; ██╔════╝╚══██╔══╝██╔══██╗██║ ██║ ██╔══██╗██║ ╚══██╔══╝ ██║ ██╔══██╗ | |
; ██║ ██║ ██████╔╝██║ ████████████╗ ███████║██║ ██║ ████████████╗ ██████╔╝ | |
; ██║ ██║ ██╔══██╗██║ ╚════██╔════╝ ██╔══██║██║ ██║ ╚════██╔════╝ ██╔══██╗ | |
; ╚██████╗ ██║ ██║ ██║███████╗ ██║ ██║ ██║███████╗██║ ██║ ██║ ██║ | |
; ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Ctrl+Alt+R Reloads this script | |
^!r:: | |
{ | |
MsgBox("Reloading autohotkey script " A_ScriptFullPath) | |
Reload() | |
} | |
; ██████╗ ██╗ ██╗██████╗ ███████╗████████╗ ██████╗ ██████╗ ███╗ ███╗ | |
; ██╔══██╗██║ ██║██╔══██╗██╔════╝╚══██╔══╝██╔═══██╗██╔══██╗████╗ ████║ | |
; ██████╔╝███████║██████╔╝███████╗ ██║ ██║ ██║██████╔╝██╔████╔██║ | |
; ██╔═══╝ ██╔══██║██╔═══╝ ╚════██║ ██║ ██║ ██║██╔══██╗██║╚██╔╝██║ | |
; ██║ ██║ ██║██║ ███████║ ██║ ╚██████╔╝██║ ██║██║ ╚═╝ ██║ | |
; ╚═╝ ╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
#HotIf WinActive("ahk_exe phpstorm64.exe", ) | |
; pressing f5 in PhpStorm activates Firefox and refreshes | |
F5:: | |
{ | |
Send("^s") | |
; integration with beyond compare's specially named session for working with the Sage external library | |
if WinExist("sage sync") { | |
WinActivate | |
Send("{F5}") | |
Sleep(200) | |
Send("{F6}") | |
Sleep(200) | |
} | |
; WinActivate("ahk_exe chrome.exe") | |
WinActivate("ahk_exe firefox.exe") | |
SendInput("{F5}") | |
} | |
; sets locale always to english | |
NumLock::PostMessage 0x0050, 0, 0x4090409,, "A" | |
~LButton & RButton::^b | |
~RButton & LButton::SendInput("{F7}") | |
~LButton & XButton1::SendInput("{F7}") | |
~LButton & XButton2::SendInput("{F7}") | |
; map alt+f4 to my often used alt+f3 | |
!F4::!F3 | |
; disable alt acceleration | |
~LAlt::Send("{Blind}{vkE8}") | |
#HotIf | |
#HotIf WinActive("ahk_exe firefox.exe") | |
F10:: ; run in PHPStorm | |
{ | |
WinActivate("ahk_exe phpstorm64.exe") | |
SendInput("{F10}") | |
} | |
#HotIf | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗██╗ ██╗██╗███████╗████████╗ ██╗ ██████╗ ██╗██╗ ██╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝██║ ██║██║██╔════╝╚══██╔══╝ ██║ ██╔════╝ ██╔╝██║ ██║ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███████╗███████║██║█████╗ ██║ ████████████╗ ██║ ██╔╝ ██║ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ╚════██║██╔══██║██║██╔══╝ ██║ ╚════██╔════╝ ██║ ██╔╝ ╚██╗ ██╔╝ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████║██║ ██║██║██║ ██║ ██║ ╚██████╗██╔╝ ╚████╔╝ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═══╝ | |
; For Ditto, it does not accept this shortcut which seems organic to my fingers. | |
#+C::SendInput("#!^c") ; instead map Ditto functionality in-app to win+shift+alt+ctrl+c | |
#+V::SendInput("#!^v") | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗██╗ ██╗██╗███████╗████████╗ ██╗ ██╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝██║ ██║██║██╔════╝╚══██╔══╝ ██║ ██║ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███████╗███████║██║█████╗ ██║ ████████████╗ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ╚════██║██╔══██║██║██╔══╝ ██║ ╚════██╔════╝ ██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████║██║ ██║██║██║ ██║ ██║ ███████╗ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Shift+WIN+L locks pc for 15 minutes | |
+#L:: | |
{ | |
; Process,Close,Cold Turkey Blocker.exe | |
Run("`"C:\Program Files\Cold Turkey\Cold Turkey Blocker.exe`" -start `"Frozen Turkey`" -lock 15") | |
} | |
; ██████╗ ██████╗ ████████╗███████╗ ██████╗ | |
; ██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝ | |
; ██████╔╝██████╔╝ ██║ ███████╗██║ | |
; ██╔═══╝ ██╔══██╗ ██║ ╚════██║██║ | |
; ██║ ██║ ██║ ██║ ███████║╚██████╗ | |
; ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝ | |
; | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗██╗ ██╗██╗███████╗████████╗ ██╗ ███████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝██║ ██║██║██╔════╝╚══██╔══╝ ██║ ██╔════╝ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███████╗███████║██║█████╗ ██║ ████████████╗ ███████╗ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ╚════██║██╔══██║██║██╔══╝ ██║ ╚════██╔════╝ ╚════██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████║██║ ██║██║██║ ██║ ██║ ███████║ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ | |
; | |
; Shift+WIN+S and Prtscr invokes ShareX to capture region | |
PrintScreen:: | |
+#S:: { | |
Run("C:\Apps\ShareX (screenshot)\ShareX.exe -RectangleRegion") | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗██╗ ██╗██╗███████╗████████╗ ██╗ ██████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝██║ ██║██║██╔════╝╚══██╔══╝ ██║ ██╔══██╗ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███████╗███████║██║█████╗ ██║ ████████████╗ ██████╔╝ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ╚════██║██╔══██║██║██╔══╝ ██║ ╚════██╔════╝ ██╔══██╗ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████║██║ ██║██║██║ ██║ ██║ ██║ ██║ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Shift+WIN+R Sets custom windows layout | |
+#R:: | |
{ | |
RepositionMyWindows() | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗██╗ ██╗██╗███████╗████████╗ ██╗ ██████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝██║ ██║██║██╔════╝╚══██╔══╝ ██║ ██╔═══██╗ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███████╗███████║██║█████╗ ██║ ████████████╗ ██║ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ╚════██║██╔══██║██║██╔══╝ ██║ ╚════██╔════╝ ██║▄▄ ██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████║██║ ██║██║██║ ██║ ██║ ╚██████╔╝ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚══▀▀═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Shift+WIN+Q opens all my shit | |
+#Q:: | |
{ | |
KeyWait("Shift") ; holding shift when launching firefox apparently puts it into troubleshooting mode :) | |
RunOnStartup() | |
} | |
RunOnStartup() | |
{ | |
Run("`"C:\Program Files\OpenVPN\bin\openvpn-gui.exe`" --command connect ecu") | |
Run("phpstorm") | |
if ( ! WinExist( "ahk_exe firefox.exe" ) ) { | |
Run("firefox") | |
} | |
WinWait("ahk_exe phpstorm64.exe") | |
WinWait("Firefox") | |
} | |
RepositionMyWindows() | |
{ | |
if(MonitorGetCount() = 3) { | |
MoveWindowsToMonitor(3, "] – ahk_exe phpstorm64.exe") | |
MoveWindowsToMonitor(1, "Find - ahk_exe phpstorm64.exe") | |
MoveWindowsToMonitor(1, "Git - ahk_exe phpstorm64.exe") | |
MoveWindowsToMonitor(1, "Bitbucket Pull Requests - ahk_exe phpstorm64.exe") | |
MoveWindowsToMonitor(1, "ahk_exe firefox.exe") | |
MoveWindowsToMonitor(2, "Terminal - ahk_exe phpstorm64.exe") | |
MoveWindowsToMonitor(2, "Run - ahk_exe phpstorm64.exe") | |
MoveWindowsToMonitor(2, "ahk_exe Spotify.exe") | |
MoveWindowsToMonitor(2, "ahk_exe slack.exe") | |
MoveWindowsToMonitor(2, "Developer Tools — ahk_exe firefox.exe") | |
} | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ██╗ ██╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██║ ██║ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ██║ █╗ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██║███╗██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ╚███╔███╔╝ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══╝╚══╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+W opens wallpaper from screen under mouse | |
#W:: | |
{ | |
openWallpaperUnderMouse() | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ██████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ██║ ███╗ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██║ ██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ╚██████╔╝ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+G searches selected text in google (good calculator!). Alternatively recognizes | |
; explorer and Regedit paths. if the shortcut is overriden by xbox crap see: | |
; https://gist.github.com/joshschmelzle/04c57d957c5bb92e85ae9180021b26dc | |
#G:: | |
{ | |
SavedClipboard := ClipboardAll() | |
A_Clipboard := "" ; empty the clipboard | |
Send("^c") | |
Errorlevel := !ClipWait(0.5) | |
if ErrorLevel { | |
A_Clipboard := SavedClipboard | |
return | |
} | |
SelectedText := trim(A_Clipboard) | |
if RegExMatch(SelectedText, "^https?://") { | |
Run(SelectedText) | |
} else if RegExMatch(SelectedText, "^(Computer\\)?(HKEY)|(HKU)|(HKCC)|(HKCU)|(HKLM)") { | |
RegJump( SelectedText ) | |
} else if RegExMatch(SelectedText, "^\d:\\") { | |
ExplorerPath:= "explorer /select," SelectedText | |
Run(ExplorerPath) | |
} else { | |
; Modify some characters that screw up the URL | |
SelectedText := StrReplace(SelectedText, "`r`n", A_Space) | |
SelectedText := StrReplace(SelectedText, "#", "`%23") | |
SelectedText := StrReplace(SelectedText, "&", "`%26") | |
SelectedText := StrReplace(SelectedText, "+", "`%2b") | |
SelectedText := StrReplace(SelectedText, "`"", "`%22") | |
Run("https://www.google.com/search?hl=en&q=" . SelectedText) | |
} | |
; Clipboard := SavedClipboard | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ █████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔══██╗ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███████║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██╔══██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ██║ ██║ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+A: Slack | |
#a:: | |
{ | |
ErrorLevel := ProcessExist("slack.exe") | |
slackPid := ErrorLevel | |
if !WinExist("ahk_pid " slackPid) | |
{ | |
Run(A_AppData "\..\Local\slack\slack.exe") | |
} | |
else | |
{ | |
if WinActive("ahk_pid " slackPid) | |
{ | |
WinClose("ahk_pid " slackPid) | |
} else { | |
WinActivate("ahk_pid " slackPid) | |
} | |
} | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███████╗ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ╚════██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████║ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+S is sublime text | |
#s:: | |
{ | |
if WinExist("ahk_exe sublime_text.exe") { | |
WinActivate() | |
} | |
else { | |
Run("C:\apps\SublimeText\sublime_text.exe") | |
WinWait("Sublime Text") | |
WinActivate() | |
} | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ██████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔═══██╗ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ██║ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██║▄▄ ██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ╚██████╔╝ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══▀▀═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+q is chrome | |
#q:: | |
{ | |
if WinExist("Google Chrome") { | |
WinActivate() | |
} else { | |
Run("chrome") | |
WinWait("Google Chrome") | |
WinActivate() | |
} | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ██╗ ██╗ | |
; ██║ ██║██║████╗ ██║ ██║ ╚██╗██╔╝ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ╚███╔╝ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██╔██╗ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ██╔╝ ██╗ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+X is play media | |
#x:: | |
{ | |
Send("{Media_Play_Pause}") | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ╚══███╔╝ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ███╔╝ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ███╔╝ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████╗ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+Z previous track | |
#z:: | |
{ | |
Send("{Media_Prev}") | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ██╗ ██╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██║ ██║ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ██║ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ╚██╗ ██╔╝ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ╚████╔╝ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═══╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+V next track | |
#v:: | |
{ | |
Send("{Media_Next}") | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ██████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ╚██████╗ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+C opens shell in currently visible folder/PhpStorm project | |
#c:: | |
{ | |
FullPath := getPathFromActiveWindow() | |
; MsgBox("aaa '" . FullPath . "'") | |
if InStr(FullPath, ":") { | |
; Run("C:\apps\cmder\Cmder.exe /start `"" Fullpath "`"") | |
Run("wt -d `"" . Fullpath . "`"") | |
} else if InStr(FullPath, "/") { | |
Run("wt -p `"Ubuntu WSL`" -d `"" . Fullpath . "`"") | |
} else { | |
Run("wt") | |
} | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ███████╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██╔════╝ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ █████╗ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██╔══╝ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████╗ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+E focuses open explorer window (for qttabbar). Pressing again opens My PC. | |
#e:: | |
{ | |
if ( WinActive("ahk_exe explorer.exe") ) { | |
Run("shell:mycomputerfolder") | |
} else { | |
FullPath := getPathFromActiveWindow() | |
hwnd := WinExist("ahk_exe explorer.exe ahk_class CabinetWClass") | |
if (hwnd) { | |
WinActivate() | |
WinWaitActive() | |
} else { | |
Run("shell:mycomputerfolder") | |
WinWait("ahk_class CabinetWClass") | |
WinActivate() | |
} | |
if (FullPath) { | |
if InStr(FullPath, ":") { | |
; Run("wt -d `"" . Fullpath . "`"") | |
} else if InStr(FullPath, "/") { | |
FullPath := StrReplace(FullPath, "/", "\") | |
FullPath := "\\wsl.localhost\Ubuntu" . FullPath | |
} | |
ExplorerNewTab(FullPath) | |
} | |
} | |
} | |
; ██╗ ██╗██╗███╗ ██╗ ██╗ ██╗ | |
; ██║ ██║██║████╗ ██║ ██║ ██║ | |
; ██║ █╗ ██║██║██╔██╗ ██║ ████████████╗ ██║ | |
; ██║███╗██║██║██║╚██╗██║ ╚════██╔════╝ ██║ | |
; ╚███╔███╔╝██║██║ ╚████║ ██║ ███████╗ | |
; ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; WIN+L: pause media and turn off monitor when locking screen | |
#l:: | |
{ | |
Send("{Media_Stop}") | |
Sleep(1000) ; Give user a chance to release keys (in case their release would wake up the monitor again). | |
; Turn Monitor Off: | |
SendMessage(0x112, 0xF170, 2, , "Program Manager") ; 0x112 is WM_SYSCOMMAND, 0xF170 is SC_MONITORPOWER. | |
; Note for the above: Use -1 in place of 2 to turn the monitor on. | |
; Use 1 in place of 2 to activate the monitor's low-power mode. | |
; Lock Workstation: | |
DllCall("LockWorkStation") | |
} | |
; █████╗ ██╗ ████████╗ ██╗ ███████╗███████╗ | |
;██╔══██╗██║ ╚══██╔══╝ ██║ ██╔════╝██╔════╝ | |
;███████║██║ ██║ ████████████╗ █████╗ ███████╗ | |
;██╔══██║██║ ██║ ╚════██╔════╝ ██╔══╝ ╚════██║ | |
;██║ ██║███████╗██║ ██║ ██║ ███████║ | |
;╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; ALT+F5 inserds current date time | |
!F5:: | |
{ | |
CurrentDateTime := FormatTime(, "yyyyMMdd_HHmmss") | |
SendInput(CurrentDateTime) | |
} | |
; █████╗ ██╗ ████████╗ ██╗ ██████╗ | |
;██╔══██╗██║ ╚══██╔══╝ ██║ ██╔═████╗ | |
;███████║██║ ██║ ████████████╗ ██║██╔██║ | |
;██╔══██║██║ ██║ ╚════██╔════╝ ████╔╝██║ | |
;██║ ██║███████╗██║ ██║ ╚██████╔╝ | |
;╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; ALT+0 Increments the selected number, or types the next number if nothing selected | |
LastIncrementedNumber := 0 | |
!0:: | |
{ | |
global LastIncrementedNumber | |
SavedClipboard := ClipboardAll() | |
Send("^c") | |
NumberToIncrement := A_Clipboard | |
A_Clipboard := SavedClipboard | |
if( ! RegExMatch(NumberToIncrement, "^-?[0-9.]+$") ) ; is number | |
{ | |
NumberToIncrement := LastIncrementedNumber | |
} | |
NumberToIncrement := NumberToIncrement + 1 | |
LastIncrementedNumber := NumberToIncrement | |
SendInput(NumberToIncrement) | |
numLen := StrLen( NumberToIncrement ) | |
Loop numLen | |
{ | |
SendInput("+{Left}") | |
} | |
} | |
; ██████╗████████╗██████╗ ██╗ ██╗ ███████╗██╗ ██╗██╗███████╗████████╗ ██╗ ███████╗ █████╗ | |
; ██╔════╝╚══██╔══╝██╔══██╗██║ ██║ ██╔════╝██║ ██║██║██╔════╝╚══██╔══╝ ██║ ██╔════╝██╔══██╗ | |
; ██║ ██║ ██████╔╝██║ ████████████╗ ███████╗███████║██║█████╗ ██║ ████████████╗ █████╗ ╚█████╔╝ | |
; ██║ ██║ ██╔══██╗██║ ╚════██╔════╝ ╚════██║██╔══██║██║██╔══╝ ██║ ╚════██╔════╝ ██╔══╝ ██╔══██╗ | |
; ╚██████╗ ██║ ██║ ██║███████ ██║ ╗███████║██║ ██║██║██║ ██║ ██║ ██║ ╚█████╔╝ | |
; ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚════╝ | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; CTRL+SHIFT+F8 turns on autoclicker -- hold right mouse button to clickspam the right one | |
AutoClickerOn := false | |
^+f8:: { | |
global AutoClickerOn := !AutoClickerOn | |
SoundBeep 1000 + 500 * AutoClickerOn | |
} | |
#HotIf AutoClickerOn | |
RButton:: { | |
While GetKeyState(ThisHotkey, 'P') { | |
Click | |
Sleep 40 | |
} | |
} | |
#HotIf | |
;████████╗███████╗██╗ ██╗████████╗ | |
;╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝ | |
; ██║ █████╗ ╚███╔╝ ██║ | |
; ██║ ██╔══╝ ██╔██╗ ██║ | |
; ██║ ███████╗██╔╝ ██╗ ██║ | |
; ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; https://www.autohotkey.com/docs/v2/Hotstrings.htm | |
; | |
; TYPE ";eur" to replace it with €. This file must be saved in UTF8 with BOM for this to work: | |
:?:;eur::€ | |
:*:r@::raveren@gmail.com | |
; ██╗ ██╗███████╗██╗ ██████╗ ███████╗██████╗ ███████╗ | |
; ██║ ██║██╔════╝██║ ██╔══██╗██╔════╝██╔══██╗██╔════╝ | |
; ███████║█████╗ ██║ ██████╔╝█████╗ ██████╔╝███████╗ | |
; ██╔══██║██╔══╝ ██║ ██╔═══╝ ██╔══╝ ██╔══██╗╚════██║ | |
; ██║ ██║███████╗███████╗██║ ███████╗██║ ██║███████║ | |
; ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
getPathFromActiveWindow() | |
{ | |
if ( WinActive("ahk_exe explorer.exe") ) { | |
ActiveExplorer := WinActive("ahk_exe explorer.exe") | |
Fullpath := "" | |
for window in ComObject("Shell.Application").Windows { | |
if (window && window.hwnd && window.hwnd == ActiveExplorer) { | |
Fullpath := window.Document.Folder.Self.Path | |
} else { | |
Fullpath := A_Desktop | |
} | |
} | |
if InStr(Fullpath, "\") { | |
if InStr(Fullpath, "\\wsl.localhost\Ubuntu") { | |
Fullpath := StrReplace(Fullpath, "\\wsl.localhost\Ubuntu", "") | |
Fullpath := StrReplace(Fullpath, "\", "/") | |
} else if InStr(Fullpath, "\\wsl$\Ubuntu") { | |
Fullpath := StrReplace(Fullpath, "\\wsl$\Ubuntu", "") | |
Fullpath := StrReplace(Fullpath, "\", "/") | |
} | |
; cmder can't handle trailing slash | |
Fullpath := RegExReplace(Fullpath, "[/\\]$") | |
return Fullpath | |
} else { | |
return "" | |
} | |
} else if ( WinActive( "ahk_exe phpstorm64.exe" ) ) { | |
ActiveTitle := WinGetTitle("A") | |
IsFound := RegExMatch(ActiveTitle, "\[(.*)\] – (.*)", &Match) | |
if (IsFound) { | |
ProjectPath := Match[1] | |
FilePath := Match[2] | |
; msgbox(ProjectPath) | |
; get dir path | |
FilePath := RegExReplace(FilePath, "[^/\\]+$") | |
if InStr(FilePath, "…") { | |
FilePath := StrReplace(FilePath, "…") | |
ProjectPath := ProjectPath . FilePath | |
} else { ; external file with full path | |
ProjectPath := FilePath | |
} | |
if InStr(ProjectPath, "//wsl$/Ubuntu") { | |
ProjectPath := StrReplace(ProjectPath, "//wsl$/Ubuntu", "") | |
ProjectPath := StrReplace(ProjectPath, "\", "/") | |
} else { | |
; PHPStorm shows project path with \ always - even windows paths, not only wsl ones | |
ProjectPath := StrReplace(ProjectPath, "/", "\") | |
} | |
; cmder can't handle trailing slash | |
ProjectPath := RegExReplace(ProjectPath, "[/\\]$") | |
return ProjectPath | |
} | |
} else { | |
return "" | |
} | |
} | |
ExplorerNewTab(path) { | |
backup := A_Clipboard | |
A_Clipboard := path | |
Run(A_ScriptDir . "\autohotkey--open-new-qttabbar-tab.vbs") | |
Sleep(100) | |
A_Clipboard := backup | |
} | |
openWallpaperUnderMouse() | |
{ | |
monitorNumberUnderMouse := getMonitorUnderMouse() | |
hexString := RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "TranscodedImageCache_00" . monitorNumberUnderMouse) | |
; format "F5A6" => "F5,A6" | |
loop Parse, hexString | |
{ | |
NewHexString .= A_LoopField (Mod(A_Index,2) ? "" : ",") | |
} | |
consequtiveZeroes := 0 | |
loop Parse, NewHexString, "," | |
{ | |
if (A_Index < 25) | |
{ | |
continue | |
} | |
; detect string end \0 | |
if (consequtiveZeroes > 1) | |
{ | |
break | |
} | |
; convert HEX to ASCII | |
if (A_LoopField = 0) | |
{ | |
consequtiveZeroes := consequtiveZeroes + 1 | |
} else { | |
ConvString .= Chr("0x" A_LoopField) | |
consequtiveZeroes := 0 | |
} | |
} | |
Run(ConvString) | |
} | |
getMonitorUnderMouse() | |
{ | |
CoordMode("Mouse", "Screen") | |
MouseGetPos(&MX, &MY) | |
NumberOfMonitors := SysGet(80) | |
loop NumberOfMonitors { | |
MonitorGetWorkArea(A_Index, &Left, &Top, &Right, &Bottom ) | |
if (MX >= Left && MX <= Right && MY >= Top && MY <= Bottom) { | |
; todo test with 3+ monitors and remove this `if` | |
; if(A_Index = 1) | |
; { | |
; return 0 | |
; } | |
; else { | |
; return 4 | |
; } | |
return A_Index - 1 | |
} | |
} | |
Return 0 | |
} | |
;Open Regedit and navigate to RegPath. | |
;RegPath accepts both HKEY_LOCAL_MACHINE and HKLM formats. | |
RegJump(RegPath) | |
{ | |
;Must close Regedit so that next time it opens the target key is selected | |
if WinExist("Registry Editor"){ | |
WinKill("Registry Editor") | |
} | |
; remove leading Computer | |
; if (SubStr(RegPath, 1, 9) = "Computer\"){ | |
; RegPath := SubStr(RegPath, 10) | |
; } | |
;remove trailing "\" if present | |
if (SubStr(RegPath, -1) = "\"){ | |
RegPath := SubStr(RegPath, 1, -1) | |
} | |
; Msgbox(RegPath) | |
;Extract RootKey part of supplied registry path | |
Loop Parse, RegPath, "\" | |
{ | |
RootKey := A_LoopField | |
Break | |
} | |
;Now convert RootKey to standard long format | |
if !InStr(RootKey, "HKEY_") ;if short form, convert to long form | |
{ | |
if (RootKey = "HKCR") | |
RegPath := StrReplace(RegPath, RootKey, "HKEY_CLASSES_ROOT",,, 1) | |
Else if (RootKey = "HKCU") | |
RegPath := StrReplace(RegPath, RootKey, "HKEY_CURRENT_USER",,, 1) | |
Else if (RootKey = "HKLM") | |
RegPath := StrReplace(RegPath, RootKey, "HKEY_LOCAL_MACHINE",,, 1) | |
Else if (RootKey = "HKU") | |
RegPath := StrReplace(RegPath, RootKey, "HKEY_USERS",,, 1) | |
Else if (RootKey = "HKCC") | |
RegPath := StrReplace(RegPath, RootKey, "HKEY_CURRENT_CONFIG",,, 1) | |
} | |
;Make target key the last selected key, which is the selected key next time Regedit runs | |
RegWrite(RegPath, "REG_SZ", "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit", "LastKey") | |
Run("Regedit.exe") | |
} | |
MoveWindowsToMonitor(MonitorNo, WinTitle, WinText?, ExcludeTitle?, ExcludeText?) { | |
MonitorGet(MonitorNo, &Left, &Top) | |
WindowIds := WinGetList(WinTitle, WinText?, ExcludeTitle?, ExcludeText?) | |
SetWinDelay -1 | |
for (this_id in WindowIds) { | |
WinExist("ahk_id " . this_id) | |
WinGetPos(&NowLeft, &NowTop) | |
MinMax := WinGetMinMax() | |
if (MinMax = 1 && NowLeft = Left && NowTop = Top) { | |
continue | |
} | |
if (MinMax != 0) { | |
WinRestore() | |
} | |
; MsgBox(MonitorNo . ' -> ' . WinGetTitle()) | |
WinMove(Left, Top, , , ) | |
WinMaximize() | |
} | |
} | |
;██████╗ ██╗███████╗ █████╗ ██████╗ ██╗ ███████╗██████╗ | |
;██╔══██╗██║██╔════╝██╔══██╗██╔══██╗██║ ██╔════╝██╔══██╗ | |
;██║ ██║██║███████╗███████║██████╔╝██║ █████╗ ██║ ██║ | |
;██║ ██║██║╚════██║██╔══██║██╔══██╗██║ ██╔══╝ ██║ ██║ | |
;██████╔╝██║███████║██║ ██║██████╔╝███████╗███████╗██████╔╝ | |
;╚═════╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝╚═════╝ | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; pressing alt+s on micro:bit saves it to device | |
; #IfWinActive, Microsoft MakeCode for micro:bit | |
; !s:: | |
; { | |
; Click, 214, 780 Left | |
; WinWaitActive, Save As ahk_class #32770 ; wait for save window | |
; Click, 614, 448 Left | |
; Sleep, 200 | |
; Click, 1130, 275 Left ; click x | |
; Sleep, 100 | |
; Click, 1084, 394 Left | |
; } | |
; #IfWinActive | |
; return | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; move window - press and hold left button -> press both mouse buttons -> move. | |
; does not work on PhpStorm as the combo is rebounded there | |
; ~LButton & RButton:: | |
; EWD_MoveWindow(*) | |
; { | |
; CoordMode "Mouse" ; Switch to screen/absolute coordinates. | |
; MouseGetPos &EWD_MouseStartX, &EWD_MouseStartY, &EWD_MouseWin | |
; WinGetPos &EWD_OriginalPosX, &EWD_OriginalPosY,,, EWD_MouseWin | |
; ; if !WinGetMinMax(EWD_MouseWin) ; Only if the window isn't maximized | |
; SetTimer EWD_WatchMouse, 10 ; Track the mouse as the user drags it. | |
; EWD_WatchMouse() | |
; { | |
; if !GetKeyState("LButton", "P") ; Button has been released, so drag is complete. | |
; { | |
; SetTimer , 0 | |
; return | |
; } | |
; if GetKeyState("Escape", "P") ; Escape has been pressed, so drag is cancelled. | |
; { | |
; SetTimer , 0 | |
; WinMove EWD_OriginalPosX, EWD_OriginalPosY,,, EWD_MouseWin | |
; return | |
; } | |
; ; Otherwise, reposition the window to match the change in mouse coordinates | |
; ; caused by the user having dragged the mouse: | |
; CoordMode "Mouse" | |
; MouseGetPos &EWD_MouseX, &EWD_MouseY | |
; WinGetPos &EWD_WinX, &EWD_WinY,,, EWD_MouseWin | |
; SetWinDelay -1 ; Makes the below move faster/smoother. | |
; WinMove EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY,,, EWD_MouseWin | |
; EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine. | |
; EWD_MouseStartY := EWD_MouseY | |
; } | |
; } | |
; ~^c:: { | |
; Sleep(40) | |
; Send("+!g") | |
; Sleep(40) | |
; WinActivate("ahk_exe firefox.exe") | |
; Sleep(40) | |
; Send("+{Tab}") | |
; Send("+{Tab}") | |
; Send("+{Tab}") | |
; Send("+{Tab}") | |
; Send("^a") | |
; Send("^v") | |
; Send("{Tab}") | |
; Send("{Space}") | |
; Send("{Tab}") | |
; Send("{Tab}") | |
; ; Send("{Tab}") | |
; Send("{Tab}") | |
; Send("^a") | |
; Send("^c") | |
; WinActivate("ahk_exe winword.exe") | |
; } | |
; ~^v::{ | |
; Sleep(40) | |
; Send("{Enter}") | |
; } | |
; Convert last entered Lithuanian letters to their number counterparts if I switch language | |
; Loop { | |
; Input, LastKey, L1 V | |
; LastPress := A_TickCount | |
; WinGet, LastWindow, ID, A | |
; } | |
; NumLock:: | |
; SendInput, {Alt down}{shift}{Alt up} | |
; WinGet, CurrentWindow, ID, A | |
; SinceLastPress := A_TickCount - LastPress | |
; if ( SinceLastPress > 4000 or CurrentWindow != LastWindow ) { | |
; LastKey := | |
; return | |
; } | |
; Matched := true | |
; switch LastKey | |
; { | |
; case "ą": SendInput, {Backspace}{Text}1 | |
; case "Ą": SendInput, {Backspace}{Text}! | |
; case "č": SendInput, {Backspace}{Text}2 | |
; case "Č": SendInput, {Backspace}{Text}@ | |
; case "ę": SendInput, {Backspace}{Text}3 | |
; case "Ę": SendInput, {Backspace}{Text}# | |
; case "ė": SendInput, {Backspace}{Text}4 | |
; case "Ė": SendInput, {Backspace}{Text}$ | |
; case "į": SendInput, {Backspace}{Text}5 | |
; case "Į": SendInput, {Backspace}{Text}`% | |
; case "š": SendInput, {Backspace}{Text}6 | |
; case "Š": SendInput, {Backspace}{Text}^ | |
; case "ų": SendInput, {Backspace}{Text}7 | |
; case "Ų": SendInput, {Backspace}{Text}& | |
; case "ū": SendInput, {Backspace}{Text}8 | |
; case "Ū": SendInput, {Backspace}{Text}* | |
; case "ž": SendInput, {Backspace}{Text}= | |
; case "Ž": SendInput, {Backspace}{Text}+ | |
; case "1": SendInput, {Backspace}{Text}ą | |
; case "!": SendInput, {Backspace}{Text}Ą | |
; case "2": SendInput, {Backspace}{Text}č | |
; case "@": SendInput, {Backspace}{Text}Č | |
; case "3": SendInput, {Backspace}{Text}ę | |
; case "#": SendInput, {Backspace}{Text}Ę | |
; case "4": SendInput, {Backspace}{Text}ė | |
; case "$": SendInput, {Backspace}{Text}Ė | |
; case "5": SendInput, {Backspace}{Text}į | |
; case "%": SendInput, {Backspace}{Text}Į | |
; case "6": SendInput, {Backspace}{Text}š | |
; case "^": SendInput, {Backspace}{Text}Š | |
; case "7": SendInput, {Backspace}{Text}ų | |
; case "&": SendInput, {Backspace}{Text}Ų | |
; case "8": SendInput, {Backspace}{Text}ū | |
; case "*": SendInput, {Backspace}{Text}Ū | |
; case "=": SendInput, {Backspace}{Text}ž | |
; case "+": SendInput, {Backspace}{Text}Ž | |
; default: Matched := false | |
; } | |
; if(Matched) { | |
; SoundPlay, %A_WinDir%\Media\notify.wav | |
; } | |
; LastKey := | |
; return | |
; Right ALT to minimize active window | |
; ~RAlt Up::WinMinimize("A") | |
; we have to wake the rainmeter skin periodically | |
; SetTimer, refresh_rainmeter, 1800000 ; check every 30min one hour = 1000ms x 60s x 60m | |
; Return | |
; refresh_rainmeter: | |
; Run "C:\Apps\Rainmeter\Rainmeter.exe" !Refresh | |
; return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClipBoard = CreateObject("HTMLFile").parentWindow.clipboardData.getData("Text") | |
Call CreateObject("QTTabBarLib.Scripting").InvokeCommand("NewTab", ClipBoard) |
- install https://www.autohotkey.com/
- download this script
- doubleclick the downloaded
aio.ahk
- press
win+w
and it should open the wallpaper under mouse - customize this script and head to https://www.autohotkey.com/boards/ for more help and inspiration!
updated to autohotkey v2 with help from https://github.com/mmikeww/AHK-v2-script-converter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
а как этим пользоваться?