I would like a string (eg "m") to expand to (eg "something") only if no other letter follows during a second. But if I write "monday" I want it to stay that way. Something like this, but working Can someone help? Thanks a lot!
We're back to the 11th commandment here:
"Thou shallt not use single character hotkey triggers in apps that accept typing."
However, I know you love to live on the edge, so:
Why hotkey? I was thinking of a string. And I am a Christian, I only know 10 commandments. Thank you very much @noisneil , I will try this right away.
Mm, do I need to set anything else here? Unfortunately this does not work "something" is always typed.
No, wait, all good!
A single character typed string is, in a context such as this, synonymous with a hotkey. Plus Moses didn't have room on the tablet for all that...
Did you download both macros?
Then Moses cannot ask me to abide by something he did not write down.
Yes, both macros. After first tests it works in 50% of the cases.
So you press
m and wait but nothing happens?
No, the opposite, I type m plus anything and it triggers.
Check that the Enable/Disable Macro actions are pointing to the other macro.
One problem seems to be this
I have restarted KM, it seems to work now, still need to test a little longer ...
You could sort of hack it in a number of ways, but none of them are good.
This is the best I can think of.
Single Key Delayed Trigger.kmmacros (2.9 KB)
But there are all sorts of reasons why its a bad idea, starting with the simulated Delete happening a second after you type the “m” which could result in deleting something unexpected if the situation has changed (or you are not in a text field).
I know, life at a mac is dangerous. Unfortunately, or maybe fortunately, I can not savor this danger because all macros work unreliably. Maybe this is a hint that I should take the 11th commandment seriously.
Macros should work 100% reliably with very few exceptions. The vast majority of my macros are perfectly reliable.
About the only one I have trouble with is one for controlling Mail compose messages because tabbing too fast between the fields confuses Mail and it's hard to come up with a reliable way to know which field it is currently in.
But other than that I'd say pretty much every other macro I use is perfectly reliable - far more reliable than I would be performing the same tasks.
If your macros are unreliable, you should look at the reason why and resolve. Timing is by far the most common cause of reliability issues, followed by just basically not handling the variations in the behaviour of the Mac over time.
Not my macros, just this one. I can only speculate about the reason. Maybe it has to do with the fact that my writing app reacts a bit slower when the cursor is in a long text. That could cause the macro to malfunction. "Timing" could therefore be the reason.
But ... are you trying to convince me to make a macro reliable for which there are "all sorts of reasons" not to use it, as you say?
What is strange is that this "timing problem" (if it is one) does not occur with BTT. But maybe it works differently there.
And now you rightly ask yourself why I want to do this with KM, when it works fine with BTT. Because I have a lot of things duplicated, in KM and BTT. That doesn't produce conflicts. But if one app is not running (for testing purposes), all shortcuts work with the other. Without these shortcuts I am lost.
Sorry, no, I misinterpreted what you said to mean that you have general issues with unreliable macros, which you definitely should not have.
It's really a question of safety as to why it's a bad idea. For example, if you press the m key as the last character you type and then switch to the Finder, what happens? There is no further keyboard input, so then the next thing to happen will be to delete the m (bad since you are now in the Finder) and then perform the actions (bad since you are now somewhere else).
The IDLE check is better than just no further keyboard, but other things could still cause it to be a problem potentially. I'd think it was ok to use in a relatively limited case (ie, if it was only used in a specific app and only under appropriate conditions), but it would be hard to ensure the macro was only active under those conditions (such as, what happens if you are in a Save dialog in the app? Or the preferences window, or whatever).