Skip to content

Instantly share code, notes, and snippets.

@RaptorX
Created October 28, 2022 14:54
Show Gist options
  • Save RaptorX/8026b9e2bf8f080df3791aa32661c7ee to your computer and use it in GitHub Desktop.
Save RaptorX/8026b9e2bf8f080df3791aa32661c7ee to your computer and use it in GitHub Desktop.
$F14::
$F13::
$F15::
; Separate the modifier keys(Ctrl, Alt, Shift) from the hotkey(F4,F6...)
RegexMatch(a_thishotkey, "O)^\$(?<mod>[\^+!#]+)?(?<key>.*)$", matched)
mod := matched.mod
key := matched.key
; Translate certain hotkeys to something ProgramName can understand
switch matched.key
{
case "F13":
mod := ""
key := "Tab"
case "F14":
key := "z"
case "F15":
mod := "+"
key := matched.key
}
if WinExist("ProgramName")
{
WinGetTitle, currentTitle, A ; get the currently active window
WinActivate, ProgramName ; activate programs window
Send, % mod "{" key "}" ; remove the $ from the hotkey before sending it
WinActivate %currentTitle% ; reactivate the previous window
return
}
Send, % mod "{" key "}" ; remove the $ from the hotkey before sending it
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment