Take Advantage of Hotstring Precedence to Deactivate Unwanted Hotstrings Firing
Sometimes AutoHotkey Hotstrings fire at the wrong time. For example, whenever I put the word AutoHotkey into a document I prefer the full word rather than an abbreviation (AHK). I use “ahk” as the Hotstring—replacing it with “AutoHotkey” in almost all cases.
However, when I started adding the same extension to my scripts, I would get “IPFind.AutoHotkey” rather than the “IPFind.ahk” that I needed. This was exacerbated by the fact that the preceding dot ( . ) caused a Hotstring reset making some of the usual fixes unavailable. I needed to disable “.ahk” as a Hotstring.
The two requirements for neutralizing an errant Hotstring include:
- The new Hotstring must appear in the script before the primary Hotstring. The first form of a Hotstring found in the script takes precedence over any following Hotstrings using the same trigger.
Note: Hotstring precedence only applies to Hotstrings loaded from the same script. The most recently loaded identical Hotstrings from another script takes precedence over any previously activated Hotstrings. - Reset the Hotstring trigger without any replacement.
The following set of Hotstrings disable auto-replacement whenever preceding the activation term “ahk” with a dot ( . ) while continuing to replace all other lower-case forms of “ahk” with “AutoHotkey”:
:B0C?:.ahk::
:C:ahk::AutoHotkey
When activated, the B0
option prevents backspacing, the C
option ensures an all lowercase trigger, and the ?
option causes immediate execution. Effectively, the activation makes nothing happen—except resetting the Hotstring trigger. AutoHotkey recognizes “.ahk” and does not replace it. Any other form of all lowercase “ahk” triggers “AutoHotkey” as its replacement.
You’ll find other, more complex methods for dealing with special Hotstring situations but sometimes all you want a Hotstring to do is nothing.
Click the Follow button at the top of the sidebar on the right of this page for e-mail notification of new blogs. (If you’re reading this on a tablet or your phone, then you must scroll all the way to the end of the blog—pass any comments—to find the Follow button.)

This post was proofread by Grammarly
(Any other mistakes are all mine.)
(Full disclosure: If you sign up for a free Grammarly account, I get 20¢. I use the spelling/grammar checking service all the time, but, then again, I write a lot more than most people. I recommend Grammarly because it works and it’s free.)
Find my AutoHotkey books at ComputorEdge E-Books!
Find quick-start AutoHotkey classes at “Robotic Desktop Automation with AutoHotkey“!
In your Digging deeper book on page 55 you have the following script. I cannot get it to work. Also why not are you using ^#m:: instead of “”^#M::
^#M::
Gui, Add, DropDownList, , Select Position on the Screen||Right Half of Screen
|Left Half of Screen|Top Half of Screen|Bottom Half of Screen|
Gui, Show, , Move Window
Return
LikeLike
It works for me! When I execute the CTRL+WIN+M Hotkey, the menu pops open.
In most cases, ^#M is the same as ^#m except when calling the Hotkey as a Label name.
LikeLike