Last active
October 24, 2017 14:24
-
-
Save davebrny/0fec50393cb06a4f51a13ec7d1b77b28 to your computer and use it in GitHub Desktop.
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
home:: | |
goTo, media_prev | |
return | |
end:: | |
goTo, media_play_pause | |
return | |
insert:: | |
goTo, media_next | |
return | |
; - - - - - - - - - - | |
media_prev: | |
media_play_pause: | |
media_next: | |
this_key := regExReplace(a_thisHotkey, "[\W]") ; no symbols | |
keyWait, % this_key | |
keyWait, % this_key, D T.2 | |
if errorLevel | |
send {%a_thisLabel%} ; single tap | |
else ; double tap | |
{ | |
modifiers := regExReplace(a_thisHotkey, "[^\Q^!+#\E]") ; only hotkey symbols | |
stringReplace, key, a_thisHotkey, % modifiers, , | |
send % modifiers "{" key "}" | |
} | |
return | |
/* | |
[script info] | |
version = 1.2 | |
description = single tap to send a media key, double tap to send the original key | |
author = davebrny | |
source = https://gist.github.com/davebrny/0fec50393cb06a4f51a13ec7d1b77b28 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
different keys can be combined if you want them to send the same media command:
if you are using multiple computers and want to send different commands from the same key name then use the
a_computerName
variableif you want to use a double tap to send the media key and a single tap to send the normal key, then change line 21 to the following: