Please help - How to tell AHK to treat symbol as legit character? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
bruin1953
Posts: 8
Joined: 22 Jan 2015, 10:27

Please help - How to tell AHK to treat symbol as legit character?

Post by bruin1953 » 07 May 2017, 11:26

I use AHK to help me type Arabic. Works like a charm. But if I type a diacritical in the middle of a word, AHK discards the top of the word, including that little thing, and starts over. If the bottom of the word is an AHK entry, it gets expanded.

I will use English apostrophe to make the point:
If
::re::regards
then
you're => you'regards
However, re'xxx is never expanded, which is OK.

I need to tell AHK, when necessary, that a certain character is legit. How?
theartofx

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by theartofx » 07 May 2017, 11:45

You could just left or right click after typing "you're". A single mouse click resets the hotstring recognizer.

So with the code:

Code: Select all

::re::regards
Typing: You're [Left Mouse Click] [space] awesome!
Would return:
You're awesome!
From the help file:
Any click of the left or right mouse button will reset the hotstring recognizer. In other words, the script will begin waiting for an entirely new hotstring, eliminating from consideration anything you previously typed (if this is undesirable, specify the line #Hotstring NoMouse anywhere in the script). This "reset upon mouse click" behavior is the default because each click typically moves the text insertion point (caret) or sets keyboard focus to a new control/field. In such cases, it is usually desirable to: 1) fire a hotstring even if it lacks the question mark option; 2) prevent a firing when something you type after clicking the mouse accidentally forms a valid abbreviation with what you typed before.
bruin1953
Posts: 8
Joined: 22 Jan 2015, 10:27

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by bruin1953 » 07 May 2017, 17:35

Appreciate the prompt reply.
Actually, I use arrows or {END} to reset recognizer. But it's pointless to think about the effect of upcoming chars.
I 'm wondering if there is a directive for this, like #Hotstring Endchars.
Thanks again.
User avatar
theartofx
Posts: 15
Joined: 07 May 2017, 15:50

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by theartofx » 07 May 2017, 17:47

I did a quick forum check for hotstring topics and found https://autohotkey.com/boards/viewtopic ... 14&t=30463 post where lexikos posted on this exact topic, I believe. Unfortunately, it does not look like this was resolved in that thread. Someone mentioned a link to dynamic hotstring as a final reply to the post, though, so maybe that might help you? Beyond that, it would be beyond me as to how to resolve the issue automatically. :?
lexikos
Posts: 6175
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by lexikos » 08 May 2017, 01:53

It most likely is the same issue, although the example (apostrophe) is not, since apostrophe is not a combining/non-spacing mark. Apostrophe (or single-quote) simply isn't a word character, although treating it as one would probably work well enough.

The regex based dynamic hotstring recognisers can work around the issue by doing negative assertions, like (?<![\w']) (not preceded by a word character). You can probably use character classes/ranges to cover non-spacing marks.

I'm pretty sure I can fix the diacritic issue, but;
I wrote:I'm not really sure whether this change would be correct for all non-spacing marks, or all non-spacing diacritic marks, or neither, as I know very little about the use of non-spacing marks in any language.
lexikos
Posts: 6175
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by lexikos » 13 May 2017, 03:00

Please try this test build and let me know in the bug report thread whether it solves the problem (with Arabic, not apostrophe).
bruin1953
Posts: 8
Joined: 22 Jan 2015, 10:27

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by bruin1953 » 14 Jun 2018, 15:59

lexikos wrote:Please try this test build and let me know in the bug report thread whether it solves the problem (with Arabic, not apostrophe).
Sorry lexikos. I got some major things in life and completely forgot the thread. My sincere apology.
Please tell me what I do with the zip file. Do I need to install it along with AHK or instead thereof?
Thanks a million for the reply.
User avatar
jeeswg
Posts: 5140
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by jeeswg » 14 Jun 2018, 16:25

The zip contains some AHK exe files, you extract them to a folder, and then drag-and-drop ahk files onto them to run your scripts. No installation is necessary.
lexikos
Posts: 6175
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Please help - How to tell AHK to treat symbol as legit character?  Topic is solved

Post by lexikos » 14 Jun 2018, 18:24

I think the fix was already included in v1.1.26.00.
bruin1953
Posts: 8
Joined: 22 Jan 2015, 10:27

Re: Please help - How to tell AHK to treat symbol as legit character?

Post by bruin1953 » 26 Jun 2018, 13:23

jeeswg wrote:The zip contains some AHK exe files, you extract them to a folder, and then drag-and-drop ahk files onto them to run your scripts. No installation is necessary.
Works great.
And better, V1.1.29 seems to take care of the problem.
Thank you. Thanks lexikos.
Post Reply

Return to “Ask For Help”