Is there any reason in particular that you can't have a user prompt open that is triggered by Keyboard Maestro and then use a typed string to do text expantion? I know Keyboard Maestro phislophy is run them all simultaneously unlike QuicKeys. I can switch to another app and and do the text expansion and it works just fine but as soon as I go back to Keyboard Maestro's dialog for a user prompt no text expansion will happen. I have even tried it with the conflict palette and Keyboard Maestro will not trigger opening the conflict palette with multiple macros with the same typed string trigger. For whatever reason hot key triggers will work but I would ideally not like to assign a hot key trigger for what I am doing.
You can't use typed string triggers inside prompt for user input text fields. See the wiki here action:Prompt for User Input [Keyboard Maestro Wiki]
Thanks for the link. That is really odd I had changed a bunch of TextExpander expansions (is that redundantly redundant) to have the conflict pallet pop up. Strange the system will allow other apps to see inside another app and won't let it's own app see inside itself. That sounds like the oppisit of sandboxing. I don't understand the logic or limitation there, that makes no sense.
" Notes : Note that the system will not allow Keyboard Maestro Engine to see keys typed in its own windows so the Typed String triggers will not work within Keyboard Maestro Engine windows."
I don't know for sure why this is, but there is a certain sense to it. You can see how this would normally work with typed string triggers -- KM sits "between" keyboard and app, watching what's typed and (sometimes) acting on it, but also passing what's typed to the app.
But if KM sits "between" the keyboard and KM you get an endless recursion of KM watching, passing what's typed to KM, which watches what's typed and passes it to KM, which... <boom!>
Thanks for explaining what you understand I can see the possibllity of a feedback loop and that would be the case with any text expansion it seems if you have TE auto expand to TextExpander and then the T and the e in TextExpander expand to that again. There would be endless loops even outside of the app. I can do text expansions from within Keyboard Maestro without this same limitation so something about when a macro is running and waiting within itself it doesn't seem to like that.
What I understand is that Keyboard Maestro hasn't built in a stop for feedback loops or potential conflicts like this.
- Hot keys are detected at the system level through different mechanisms than regular typing. They're typically registered with the operating system directly and can work across all applications, including the app that registers them.
- Typed string triggers require the app to monitor a continuous stream of typing, which creates a potential infinite loop problem when monitoring itself:
- If KM monitored its own typing input, it would create a circular reference
- KM would see a keystroke, process it, then send it to itself, then see it again, process it again, etc.
- This would cause either a crash, strange behavior, or performance issues
Monitoring itself meaning the engine while it is running it's own macro in can't run another macro that the engine is running and interact with it but it can run another macro while the window is up in another app and even Keyboard Maestro (editor).
I wonder if there is any workarounds for such a thing.
You already spoke of a workaround. Use another utility app.
Are you sure
I should have been more explicit above -- remember, it's the KM Engine that is monitoring and passing events, including keypresses, but it's the KM Editor that you are doing the expansion in.
But KM dialogs are "owned" by the KM Engine, which is why KM can't do text expansions in them.
It may not even be an "Apple knows best" decision that stops an app from seeing keys typed in its own windows -- I could see that it might not be possible to have the same process in two places in the event chain... How would the event-handling system know which is which, how would the process know at what stage in the chain the event is when it receives it?
Haha, looks like I need to be more clear, in Keyboard Maestro. I'll probably just assign it to a global macro with a hot key though nearly all of those are filled up and I moved them over to see all of the list at once with the conflict palette.
Absolutly, that was the conclusion I came to as well.
Great question and the answer is... .
Thanks for the feedback.
I'm curious why or how it works that when I have a dialog up it is aware that the dialog is up but if the application I am in still is recognized as the front application and all the keyboard shortcuts are entered into the dialalog when I type things that are single keys for that application. Perhaps this is also part of why Keyboard Maestro chooses not to follow Text Expansions but it will follow them for the app I am in still along with the other shortcuts. Anyway no need to reply, I'll slowly figure this out and have an ah-hah moment.
I realise this probably isn't what you're looking for, but in case it's helpful in any way (for you or anyone else): If you already happen to use Alfred or BetterTouchTool, both of these tools can also do text expansion, and I think (though I've not done it myself) you can use BetterTouchTool to trigger KM macros.
This is not something Keyboard Maestro "chooses" to do or not do -- it's a limitation of the operating system. And it is nothing to do with text expansion per se and everything to do with the Typed String trigger -- you can, for example, "Insert text by typing" in a KM "Prompt for User Input" dialog if your insertion macro has a Hot Key trigger.
Don't forget that you can spoof simple text expansions via System Settings -> Keyboard -> Text Replacements... If you have the same in both then KM's trigger will take precedence whenever the KM Typed String trigger is valid but the Text Replacements version will be used in a KM dialog. That may be enough if you don't want a second (or third!) utility running.
This is exactly what I do. It also has the added bonus that the same typed string triggers can be used on my iPhone as the Apple Text Replacements sync via iCloud between all devices.
As you say, the KM version will take priority on the Mac but in certain places on the Mac where the KM version doesn’t work the Apple version will jump in.
It’s a method I have been using for several years and works without issue. I have to maintain the text replacement list in two places (Mac and KM) but I think the whole point of typed string triggers is that once set up they very rarely change as they rely on remembering them when quickly typing.
This is not about what Keyboard Maestro does or doesn't do, or about infinite loops.
It is simply the way the system is architected - events destined for the Keyboard Maestro Engine do not pass through the Keyboard Maestro Engine event filter.
People can speculate on the why's of this, but unless someone finds the relevant Apple engineer who made the decision 20 years ago (maybe while they were working for NeXT?), its not likely to be accurate.
Thank you.
Yeah, that is very helpful that is possible. It is interesting if you do the keyboard shortcut approach and it pulls up the conflict palette it will not paste into the dialog and loses focus of that since I guess it is not an app per se.
I do this as well for many of them since I don't have a microphone thanks to Apple on the TextExpander keyboard. I have also found that using third party apps can conflict with some apps when expanded and give strange results like in the case of Upnote.
Learning most everytime I come here. Thanks.