I use thousands of AHK hotstrings. For example (simplified):
::btw::by the way
Unlike most AHK users, the only endkey I allow is \
. So when I type btw\
, I get by the way
. Space or enter or other such keys do not set off the hotstrings. This ensures that hotstrings are never set off unintentionally.
Now, I also use chords. Here's a simplified version of one my chords:
~t & g::
~g & t::
SendInput {Backspace}
SendInput {Space}the{Space}
Return
The way these chords work is that if I press my finger on the border between the t
and g
keys, AHK types the
(Including a space before and after.) Very useful.
Now, I'd like to take this up a notch: I want chords to automatically set off hotstrings. For example, say I want to type by the way the
. I could type btw\
and then t
and g
together. But, it would be nicer if I could skip the backslash, and instead have the chord automatically set off the hotstring. (Only in the case where the text immediately before a chord is a hotstring, of course.)
Now obviously, I want this to work not only for this specific combination of btw
and t
+g
, but for any combination of hotstring and chord from my vast collection.
How can I do that?
(One idea that came to mind is that AHK probably has a function that it launches every time you hit an endkey, which does something to the effect of "Look at the text that the user typed so far. Is it a hotstring? If so execute it." If only I had a way to invoke that function from inside my chord script, that would solve my problem. However, I have no idea how to do that.)
After spending about 10 hours on it, I've decided to abandon this project. Besides all the usual AHK horribleness and bugs, there's the intractable problem that if I type I love the sun
and then 7
and u
at the same time, I'll get I love the Sunday and
instead of I love the sun and
, because AutoHotKey has no way of knowing I didn't mean it to expand the hotstring in that instance.