I already said, it prevents hotstrings(k) from removing k from the list of expressions. For example,Regarding your post, I don't understand the bug you mention?
hotstrings("\bann(a|e)" , "Ann%$1%") ; This is supposed to "remove hotstring definition from triggering an action": hotstrings("\bann(a|e)")
I forgot to replace "$" with "$$" in k and a. For example,Your second change breaks entries like ...
t := RegExReplace(t, "\n\Q" . k . "\E\r.*?\n|$", "`n" RegExReplace(k,"\$","$$$$") "`r" RegExReplace(a,"\$","$$$$") "`n", _, 1)Notice that the replacement string is actually "$$", with each doubled up to specify a single literal character.
Again, I already said what it does: replaces any identical expressions already existing in the list. For instance, without the change, code like the followingIf possible please post back on the problem there and what difference changing that line should make.
hotstrings("omg" , "oh my god") Sleep, 5000 hotstrings("omg" , "oh my god{!}")will result in "omg" being expanded to "oh my god oh my god!" if the script has been running for at least 5 seconds. This is because there are two "omg" entries in the list (but also because of the first issue in the list below.)
Both of these changes are specifically useful for loading hotstring definitions from an external file, and later reloading them or modifying them via a GUI. (Someone Asked for Help with such a script recently.)
While debugging this, I've noticed some other issues:
[*:145j8knn]Sometimes the "recognizer" seems to act on what was there, not what it was replaced with. (One could argue that neither should be recognized, but that's not the point.) For instance, if I use hotstrings("\bann(a|e)", "Ann%$1%") and type "anna", it replaces it with "Anna". If I then backspace the "a" and type another "a", or type some other letter then backspace it, "Anna" is replaced with "Anna".
[*:145j8knn]I had originally noticed it with "oh my g" being replaced with "oh moh my god" or something similar. After modifying the script, it no longer happens this way for "omg"->"oh my god". :?[*:145j8knn]This is especially problematic if I click into another window (like Firefox) and start typing then backspace what I typed, as it then deletes part of my text and types "Anna". This is partly a separate issue:
[*:145j8knn]Unlike AutoHotkey's hotstring recognizer, hotstrings() does not reset when you click, press arrow keys, home, end, etc. (Clicking and +home,delete are the main problems for me.)[/list]