I have converted my about 3 thousand MS Office AutoCorrect entries => to => AutoHotKey Auto Replacers. This will save significant time. But I discovered that the triggering of Auto-Replacers with a Replacement Text that has an accent or cedilla causes the Left-Control key to keep held down after the triggering, despite the fact that the Replacement Text has no Control key. This happened very frequently, because I am a Brazilian and the Portuguese language has many accented words and with ç (cedilla), about 1/3 of all words or phrases are in this group.
It is important to note that this holdding of the Left-Control key only acts over keyboard shortcuts defined with AutoHotKey itself, not over keyboard shortcuts native to programs or native to Windows. For example: After the triggering of an Auto-Replacer that has an Replacement Text with an accent or cedilla, to type only the Q letter triggers a macro of a running AutoHotKey script that has a macro triggered by Ctrl+Q, but neither to type only A (from the common native Ctrl+A shortcut) thriggers 'Select All' nor to type only P (from the common native Ctrl+P shortcut) opens the 'Print' dialog.
Why is happening this holding of the Left-Ctrl key by accented or cedilled Replacement Texts, even without any Ctrl key on them? Is it a bug? No #HotString options, including T our R, are able to avoid it.
As you will see below, I have found a good solution to the problem, but I think that AutoHotKey would be better if this problem did not exist.
This problem can be easily simulated, as follows:
1) Create the following macro and auto-replacers and run the script with them :
Code: Select all
^Q:: MsgBox To press Q alone triggered this macro (instead of Ctrl+Q). ; Only a MsgBox, to test if, after the triggering of an auto-replacer, the Control key is held down inside AutoHotKey.
::ee::é ; Auto-Replacer with an accented Replacement Text
::ac::ação ; Another Auto-Replacer with an accented Replacement Text
::cc::caça ; Auto-Replacer with a cedilled Replacement Text
::mt::muito ; Auto-Replacer with a Replacement Text that does not has an accent or a cedilla
::qq::qualquer ; Another Auto-Replacer with a Replacement Text without an accent or a cedilla
::na::não{control up} ; A solution to the problem, by including {control up} after the Replacement Text, at an Auto-Replacer by Auto-Replacer basis.
2) Type the following 4 letter string 'ee q' (including the space). The 'ee' abbreviation is replaced with 'é' and the following q, by itself, triggers the Ctrl+Q keyboard shortcut.
3) Close the MsgBox and type Q again. The MsgBox displays again. Repeat how many times you want to see that this undesired effect continues.
4) Type P (from the Ctrl+P native shortcut, that usually open the 'Print' dialog). NO 'Print' dialog opens. This shows that the held Left-Ctrl key only acts over AutoHotKey shortcuts, not over shortcuts native to programs or to Windows.
5) Type some more letters and type Q again. The MsgBox opens again, because the Left-Ctrl key remains held down.
6) Type the Left-Control key to free it. Then type Q again. The Q is included in the text as it always should, because the Left-Control key was released.
7) Type the following 4 letter string 'mt q' (including the space). The 'mt' abbreviation is replaced with 'muito' and the following q only includes the q letter, as it always should.
8) Repeat the steps 2 to 7, this time using the 'ac q' and the 'qq q' strings at the steps 2 and 7 respectively, only to make sure that it is the presence or absence of an accent at the Replacement Text that is holding down the Left-Ctrl key.
9) Repeat the steps 2 to 6, this time using the 'cc q' string at the step 2, to see that the presence of the ç (cedilla) at the Replacement Text also holds down the Left-Ctrl key.
10) Type the following 4 letter string 'na q' (including the space). The 'na' abbreviation is replaced with 'não' and the following q only includes the q letter, as it always should.
This last step demonstrates the fix to the problem: to include {control up} after each Replacement Text with na accent or a ç (cedilla) , but to make '::na::não' work would be much better than the need of '::na::não{control up}', mainly because it is not easy to identify this problem well and to find this solution for it. Indeed it took me a lot of time and some disappointment until I was able to find this solution.
Is this problem a bug? If so, is it resolvable?
Thank you.
Marcos Cançado Ribeiro