Auto-replace with backslash doesn't work
Hello,
I discovered your project and tried to import my scripts from windows to Linux.
One of my main uses for AHK are replacement for macros when typing latex. Most of the lines in my scripts look like:
:*:\aa::\alpha
When trying this with AHK_X11 it does not work. Clearly it is unhappy with the backslash in the abbreviation. I couldn't find any info in the documentation about backslashes being not supported, and it does work with AHK on windows.
Is there anything I can do (like escaping the character? I was not successful) about it? Or is it a limitation?
Thanks!
Hi! That's because \ is part of the default hotstring end chars https://phil294.github.io/AHK_X11/#h_Hotstring.htm.
If you include this in your script
#Hotstring EndChars -()[]{}':;"/,.?!`n `t`r
you'll essentially be removing the backslash from it and your snippet will work.
Very interesting that it worked on Windows though, as on there, the same default set of EndChars includes the backslash: https://www.autohotkey.com/docs/v1/Hotstrings.htm#EndChars So I assume that when the string includes some of the end chars, they affect the overall global end chars directive?! Unsure how this is supposed to work exactly. Maybe someone else has an idea. But either way, ahkx11 should work the same way as win ahkv1.x works, so I'll leave this issue open.
Thanks for your answer!
Now to answer to your comment on AHK on windows: my scripts actually contain the following lines
#Hotstring EndChars `n `t
#Hotstring c
which I honestly have no memory why they are there, but from your previous message I understand that they helped me among other things to define shortcuts containing backslash, brackets etc... So the bug was between the chair and the screen here!
EDIT: actually I tried what you proposed with a script containing the following lines and ... it does not work?
#Hotstring EndChars -()[]{}':;"/,.?!`n `t`r
:*:\aa::\alpha
It does work for me! :/ which keyboard layout do you use?