A traditional hotstring cannot be defined if its trigger string ends with a backtick, like
::a``::b
AutoHotkey 2.0.10 only pops up a very unhelpful message box, telling that I seem to want to use AutoHotkey 1. No information about where and what the problem was in the script.
It works if the backtick is not the last character in the trigger string.
Also, the Hotstring command works with a trailing backtick. Only the traditional form brings up the dreaded "It looks like the script you are trying to run requires AutoHotkey v1..."
Hotstring trigger string ending with backtick in v2 Topic is solved
Re: Hotstring trigger string ending with backtick in v2
I don't get any error message for:
This hotstring works for me as expected in AHK v2.0.10 (like in v1) - both on german layout (there, ` is a dead key) and US layout (normal key).
Is there perhaps something else in your script which causes the problem? Is this the actual code you are trying to run?
Code: Select all
::a``::b
Is there perhaps something else in your script which causes the problem? Is this the actual code you are trying to run?
Re: Hotstring trigger string ending with backtick in v2
The script contains this single line. Windows 11, American English version. The script is edited in Notepad, and saved in UTF-8 format.
Re: Hotstring trigger string ending with backtick in v2
There is another ugly workaround (besides using the HotString command):
::a``:::{BS}b
It looks like the parser treats the second backtick as escaping the colon, but the interpreter treats the two backticks as one literal backtick. The replacement string is then ":b", so a backspace is needed to remove the extra colon. It is also possible that the executable was compiled with such local settings, where the backtick is treated as a modifier key, but it looks unlikely.
::a``:::{BS}b
It looks like the parser treats the second backtick as escaping the colon, but the interpreter treats the two backticks as one literal backtick. The replacement string is then ":b", so a backspace is needed to remove the extra colon. It is also possible that the executable was compiled with such local settings, where the backtick is treated as a modifier key, but it looks unlikely.
Re: Hotstring trigger string ending with backtick in v2
That isn't AutoHotkey 2.0.10. That is the AutoHotkey Launcher (UX\launcher.ahk). The launcher is a separate process which decides which interpreter to execute the script with (there can be any number of versions installed, 32-bit or 64-bit, etc.). Your script triggers a false positive of the rule that naked escape characters aren't valid in expressions in v2 (e.g. Send `` would be valid only in v1). You can circumvent it by adding #Requires AutoHotkey v2 to your script.AutoHotkey 2.0.10 only pops up a very unhelpful message box, telling that I seem to want to use AutoHotkey 1.
Not "the parser", just a complicated regex pattern used by the launcher.It looks like the parser treats the second backtick as escaping the colon, but the interpreter treats the two backticks as one literal backtick.
Re: Hotstring trigger string ending with backtick in v2 Topic is solved
Thanks, lexicos. Adding #Requires AutoHotkey v2 to the script indeed hides this launcher problem.
Who is online
Users browsing this forum: No registered users and 34 guests