Reputation: 165
I wish to use AutoHotKey to generate some text based on a combination of a Alt key press plus 2 or more characters ...for example hold Alt key down then press 23 and the result would be some text string pasted into the editor...
I know how to do this for Alt plus 1 character, but not multiple characters ...example:
!1::
send Hello
return
Uses Alt plus the number 1 to generate the string Hello ...I would like to be able to use Alt plus 1A or Alt plus CB to cause the string to be generated ...is this possible ?
Upvotes: 0
Views: 641
Reputation: 6489
There are many many ways this can be achieved, some come with more downsides then others.
One really simple way that has pretty minimal downsides is utilizing A_PriorHotkey
(docs) to make a context sensitive hotkey with #If
(docs) like so:
!2::return
!2 up::return
#If, A_PriorHotkey == "!2"
!3::SendInput, hello
#If
The !2
and !2 up
hotkeys are there just to a value to A_PriorHotkey
.
The downside here is of course losing the native functionality of Alt + 2.
Further trickery could be added in so the (at least almost) native functionality of Alt + 2 could be kept as well. But I won't speculate of any of the finer details and edge cases on how you'd want these multi-combination hotkeys to work. You'd have to clearly state that yourself.
Upvotes: 1