Search code examples
autohotkeyahk2

AutoHotkey hotstring not replacing trigger text containing "!b" correctly


I'm having trouble with an AutoHotkey script where a hotstring isn't replacing the trigger text correctly.

Here's the specific line of code I used:

:*:;container;::>[!blank-container|float-left-small]

I expect that when I type ;container;, it should be replaced with >[!blank-container|float-left-small].

However, instead of getting the expected output, I'm getting >[lank-container|float-left-small].

It seems that the replacement text is ignoring the characters "!b" from the output

I've tried removing any conflicting commands, like the backspace command (Send {backspace 11}), but the issue persists.

Could someone please help me understand what might be causing this issue and how to fix it? Thank you!


Solution

  • When the Send command or Hotstrings are used in their default (non-raw) mode, characters such as {}^!+# have special meaning. To use them literally in these cases, enclose them in braces:

    :*:;container;::>[{!}blank-container|float-left-small]
    

    or use the raw mode:

    :*R:;container;::>[!blank-container|float-left-small]
    

    or the Text mode (recommended):

    :*T:;container;::>[!blank-container|float-left-small]
    

    See also Escape Sequences