"match after a word break" doesn't

I have a macro with a string trigger of ai set to match after a word break. But it always triggers after just those two letters and before a space or tab.

Is there something else I need to set that I've missed?

OS X 10.11.1 and Keyboard Maestro 7.0.1.

Correct. It matches after a word break. It does not require a word break to follow it. Otherwise it would have to know in advance whether the next key was going to be a word break or not and its not prescient. If it waits until you press another key, then there is another keystroke that needs to be remembered, undone, and then redone, and it is impossible to do that without race conditions and possible negative consequences.

So it will match if you type “aim” but it will not match if you type “main”.

You will need to adjust your trigger, perhaps include a trailing character.

OK, and that’s how I fixed it; I added a space to the end of the trigger string.

I was thinking the setting would cause it to trigger if a word space were typed after the trigger string. Something like:
ai
ai
ai,
etc.

Yes, as described the problem with waiting until you type space, tab, comma, full stop, etc after the trigger is you now have to deal with that character, and there is no way to deal with it that works in all cases due to the nature of the queueing system for events.

And as a general rule, if I can’t do something reliably in Keyboard Maestro then I usually wont do it at all.

Hey, just stumbled upon this thread, had the exact same problem (or better: Misunderstanding :wink: )

My actual goal was to have “hotstrings” that are triggered whenever I finish the hotstring “word”, in whatever way. E.g. by a space, pressing the return key, entering a period or comma…
Is there a way to achieve that goal?
I have now entered a space character behind all my hotstrings, but (of course) now they are triggered only, if I hit space after entering the string.

There is a utility called “Spark”, which is able to do that. I don’t want to use it, though, because the hotstrings defined there don’t work in all curcumstances. E.g. text input fields in browsers are not served by Spark, as it seems. Keyboard Maestro ist more reliable in that regard.

Thanks a lot!
Daniel

Thanks for bringing this topic back to the surface. I never understood that either, until now.

And I usually use an underscore at the end of the characters to trigger it. Much less likely to type that in a real context.

I have a naming convention for all of my "typed string triggers", whether used in Keyboard Maestro or any other text expander app:

;<WhateverText>[SPACE]

For example: ;ver.km

I have found that having both an uncommon character to start the string, and then a [SPACE] to terminate it to work very well, very consistently.

I don't see any issue with hitting [SPACE] to terminate the string.
What issue/concern do you have with using a [SPACE] ?

1 Like

Not exactly an issue, but it would be nice to stay in my habit to just use a hotstring as any other word, simply ended by space OR by comma OR by return... But if it's not possible with KM, I'll have no big problems to change my habits. :wink:
My hotstrings (the term "hotstring" comes from a utility that I used back when I neded to use Windows at work. Don't recall its name, but it called those string triggers or string replacements "hotstrings") are usually very short. "vg" for "Viele GrĂĽĂźe (=best regards) etc.
most of them don't appear inside a word usually. However, even if they did, that should not be a problem, if they are treated as words, i.e. only trigger the replacement, if they are ended like any other word, i.e. by space OR comma OR period OR return... (actually any non-alphanumeric character).

Hey Daniel,

Typed-triggers can be regular expressions.

See this thread:

-Chris

1 Like

As Chris said, you can use a RegEx as the trigger, which is probably the best solution in this case.

You can also have multiple triggers, any one of which will trigger the Macro.