tags:

views:

119

answers:

1

Hi, I'm trying to do many text replacements. Some of the replacement triggering abbreviations are prefixes of other triggering abbreviations, like so:

:*:foo::the
:*:fooed::there

Currently, this produces:

foo = "the"
fooed = "theed"

"foo", being the prefix of "fooed", is firing too soon. This could easily be fixed by removing the "*" and requiring an ending character. However, this way has valuable predictive text features that I would like to keep.

The way I can see doing it would be to do the hotstring replacement as soon as "foo" is typed, but to keep "foo" in the hotstring "clipboard". Then, when "ed" is added, the full clipboard will be "fooed" which will autotrigger the replacement to "there". The clipboard will reset after using an ending character like space or period.

Can anyone help me with the AHK syntax?

A: 

Not sure if it's what your looking for, but you can use hotstrings like hotkeys... What you could try is using either the "KeyWait" command or the "Input" command inside the foo hotstring, to check if the next letter typed is "e". If the user pressed "e", then skip the foo hotkey using "Return"... If any other key was pressed, fire the hotstring. It's not a flawless idea, but it's closer, and you can add any error handling you choose within the statement.

"The way I can see doing it would be to do the hotstring replacement as soon as "foo" is typed, but to keep "foo" in the hotstring "clipboard". Then, when "ed" is added, the full clipboard will be "fooed" which will autotrigger the replacement to "there". The clipboard will reset after using an ending character like space or period." - Seems like way too much work. The clipboard is a fickle item, and should be reserved for rare uses... Not to mention that something like that would require additional - very annoying - calculations.

Sivvy