Sometimes the Input Command Solves a Sticky Hotstring Problem
* * *
I promised an associative array tutorial for my next blog, but this topic intervened. I should have the tutorial ready for next Monday.
* * *
Recent comment on my blog “Auto-Capitalize the First Letter of Sentences“:
This routine can be handy, though the main issue is that, in AHK, “if more than one hotstring matches something you type, only the one listed first in the script will take effect”. Actually, I’m not sure about that, as it appears that using the asterisk as a hotstring option takes precedence. In any case, this does seem to have the effect that other hotstrings that could otherwise be used cannot be used if they also match the code provided here. I have lots of those types of hotstrings, which I use on new lines and after punctuation. I have been unable to find any solutions to this since AHK does not accommodate sequential firing.
A short demo:
:T:tn::Thanks
:C*?:`nt::`nT
Run this script. Type “Tn” on a new line. It works to type “Thanks”. Now type “tn” on a new line. The first line in the script is now skipped. You see only “Tn” in response.
Comment On “AutoHotkey Tip of the Week: Auto-Capitalize the First Letter of Sentences” by mikeyww
Whenever a Hotstring fires, it resets and waits for the next Hotstring. Therefore, the firing of the new line character and “t” (`nt
) removes the letter “t” from the next string and starts over with the “n” character. The asterisk option (*) does not affect this behavior. It merely causes that Hotstring to fire before the first—then reset—prior to pressing the “n” key. However, I do appreciate the problem.