Sometimes We Limit Our Scripts by Not Grasping How AutoHotkey Features Respond
In AutoHotkey, we use Hotstrings for automatic text expansion and replacement—as in the extensive list of common misspellings found in the AutoHotkey AutoCorrect.ahk script. After loading this series of Hotstrings, if you misspell one of these words, AutoHotkey instantly corrects it. I’ve included this as a standard part of my main AutoHotkey script and often watch the Hotstrings in action when they correct one of my typos or misspellings.
Whenever a Hotstring fires, it resets and waits for the next one. Most commonly, this occurs when we type a space, period or other punctuation as a Hotstring recognizer. One might fall prey to the misconception that every such space or punctuation key press causes a Hotstring reset, but not so. Hotstring monitoring only resets when a Hotstring event occurs (or with a mouse click or cursor movement). That means we can include spaces and punctuation in the activating strings (or Hotstring definitions) which appear after the first double-colon.
Most AutoHotkey users might understand this fact about Hotstring activators, but I write about it here for those of us who either never fully realized the importance of this aspect of Hotstrings or we just forgot. Knowing this fact allows for a number of additional types of Hotstrings rather than limiting ourselves to standard text expansion and replacement. A perusal of the AutoHotkey AutoCorrect script lets us peek into how we can take advantage of this aspect of Hotstrings. Continue reading