Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active November 7, 2017 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davebrny/ce25602584c77a50959334ce8ec2e989 to your computer and use it in GitHub Desktop.
Save davebrny/ce25602584c77a50959334ce8ec2e989 to your computer and use it in GitHub Desktop.
(autohotkey) - prepare hotkey text for the send command: ^!a to ^!{a}
send_hotkey(string){
modifiers := regExReplace(string, "[^\W]")
stringReplace, key, string, % modifiers, ,
return modifiers "{" key "}"
}
/*
[send hotkey]
description = prepare hotkey text for the send command: ^!a to ^!{a}
source = https://gist.github.com/davebrny/ce25602584c77a50959334ce8ec2e989
*/
@davebrny
Copy link
Author

davebrny commented Feb 12, 2017

send % send_hotkey(a_thisHotkey)

autohotkey's send command will send the text ^a as ctrl + a but will send something like ^printscreen as ctrl + p and then send "rintscreen" as text after it.

this command would convert ^printscreen to ^{printscreen} (wrapping the main key in braces) so it can be used with the send command to send ctrl + printscreen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment