Text Field - Feature Request

It would be great to have an option in the macro "Groups" section that would allow a macro to be available or not available inside of a text field. This would allow the opportunity for single key keystrokes and the use of shift as a modifier without compromising the ability to type normally when needed.

Though simple in concept, in my exploration on the matter it seems that this may be a lot more difficult than it appears at face value. I'm guess that would explain why it hasn't been implemented into Keyboard Maestro already.

In the event this is an impossible request and so that I can expand my understanding of the matter and get pointed in the general right direction... is this something that has to be configured per application or is it system wide?

I see some value in that idea, but I may have an acceptable alternative for you. You see, if you are inside a text editable field, there is a menu item called Paste inside the Edit menu of the app. So all you have to do is check if that menu item exists, and if it does, then the user is in an editable text field.

Using a similar method you can tell if the user has selected text, because then the Copy menu item will exist.

As far as I know, these sorts of techniques are application specific, not macOS specific, because they are implemented with AppleScript procedures and variables. That's most likely why this can't be implemented reliably in KM, because KM can't be responsible for every different app out there.

Hi Sleepy,

Yes, thank you for your advice. It appeared to me that it might be application specific but so much was over my head that I wasn't really able to follow most threads. Unfortunately for the specific app that I would like to use the feature for (Logic Pro) it has a paste option available even when a text field is not selected which prevents me from using the method you provided.

I'm not sure how I can accomplish the intended goal without learning a whole bunch of code that would take a substantial amount of time. I really appreciate your input, though!

Thanks!

Yes, I can see why Logic Pro might accept things other than text, so my idea won't work for it.

Logic Pro is made by Apple, I think, so it's likely that it supports AppleScript, and one of the gurus on this site may be able to tell you how to handle it. It shouldn't be too difficult once they tell you how.

In the worst case, I may even be able to give you a method to solve this using the user interface. But to do that I would need to see screenshots of the text boxes you want to be checking against. In fact, if you can show me that now, why not? I've solved many problems using visual cues before.

1 Like

It's really hard to get single keystrokes to fire Macros reliably in any App. As @Sleepy says, the usual approach is to look for a menu condition that changes when you are typing text, in order to disable the macro when you are in a text field. (And on my inspection of Logic Pro there is no such change in the menu when typing text that I could find.)

The single letter hotkeys that are built into Apps (like "R" for record in Logic Pro) have been designed to work this way but that is because they are built into the Apps at some fundamental level.

The inbuilt single key hot keys are usually for doing one single action or changing the state of something (like "A" to change the mouse cursor to a selection tool). They are not for complicated multi-step actions that could be damaging if the single key was pressed by accident.

If the single key hot key you are trying to make is to simply invoke an existing function that already exits in the menu, you can make your own custom single key hot key using Mac System Preferences or very often in the App itself.

The problem with the single key approach with firing Keyboard Maestro Macros is that if you have many Macros that do things (in say, Logic Pro) how are you going to remember all those single keys? It's very likely that you will fire Macros by accident even if you get the "not in a text field" condition to work.

For what it's worth my approach to App specific Macros is to make use of Keyboard Maestro's floating Palettes. The Palettes can be shown and hidden with a hot key (in my case I always the same hot key ⌥⌘K to show/hide the Keyboard Maestro Palette for whatever App I am in). The Palettes are easy to click on to fire the Macros, they give a visual reminder of whatever the hot keys are and I can make custom Icons that make finding my Macros very easy. Nothing to remember - which is especially good if I am not using the App every day.

image

image

3 Likes

Sleepy - Yeah, in another life I'd be an Apple/Logic developer and implement all of my harebrained ideas but, atlas, I'm a niche of a niche so I understand why many of the ideas haven't made it in the program. I avoid using UI as much as possible because I'm constantly moving things around and prefer discreet workflows.

Zabobon - Your solution is similar to what I had contemplated initially which was to have a hot key that would enable/disable the macro group for all of the single key shortcuts so that when I needed to type I could disable them.

Ultimately, the solution I think will work best for me is to get a second keyboard and custom key caps with all the functions I am planning to create macros for. It's certainly not the most cost efficient, but it will achieve the goal I'm after.

Thank you both for your insights. Once I put it all together, I'll try to find the time to make a video demonstrating the setup and various workflows!

@ncbasic I've spent some time with a Stream Deck and Logic Pro, and can heartily recommend it as a combo. For me, it means ultimate flexibility and never having to remember a hotkey again!

Unfortunately, there is no practical way to do this.