Would it be possible to have a script NOT activate if in a text field?
Specifically, I am setting up a lot of macros to control the Finder in what I am calling the "DAMn Finder".
For the purpose of substituting it as a Digital Asset Manager. Hence: Digital Asset Manager I(n) Finder.
So essentially, I am setting up a whole lot of macros by hotkey. Many of them are regular characters if in a text field.
But if I am in a text field, I want to type the character not activate the Macro. It would be SO NICE to have an option to not activate macro in text fields.
Thank you and Cheers!
Ñ
I've hit this from time-to-time as well in other situations. I haven't tested the following, but you could try it. It relies on the idea that the Paste command is only present in the Finder when you are in a text field. (If you have copied a file and are not editing a text field, the command changes to Paste Item instead). I could be wrong in this assumption.
Let's say the letter "s" is your trigger.
- Save the current clipboard
- Using Set Clipboard to Text: If the shift key (or Caps Lock key) is down, assign "S" to the clipboard, otherwise assign "s" to the clipboard.
- Check to see if the Finder's Paste command is enabled.
• If it is, then issue the Paste command. This will type the "s" or "S".
• If it is not, do your DAMn function! (sorry)
- Restore the clipboard you saved in step 1.
Richard,
Thanks for the tips! Not quite sure how to check to see if the Finder's Paste command is enabled or not. But the rest makes complete sense.
Ok, after a few moments of digging, I think I figured it out. Very interesting. Makes me wonder what else I can apply to this type of condition.
Though, I do think this would be best suited built in, functional = functional.
Thank you very much!
Ñ
Hey Chris,
Many people what that functionality, but there's no way for Keyboard Maestro to provide it.
The system hotkey manager doesn't have a switch for text-field-is-active.
Anything you do with single key hotkeys will have repercussions on normal typing.
What I do when I want single-key hotkeys is this:
I have several macro groups set up to open a palette on command:
The hotkeys are only active when the palette is visible, and the palette is my visual cue that normal typing is altered.
In general I don't recommend one-key hotkeys (outside of function keys). I tend to replace them with Option-K, or Control-K, or Cmd-Opt-K – something my fingers can easily find.
That said – single-key hotkeys have their place.
-Chris
-Chris
One key hotkeys: I get it. Especially under the circumstances you describe. However, that is the way I wish to do it for some. In most cases, this isn't an issue. In the finder, changing the name and doing searches are the fields I use. I tend to use the row of number keys and don't have any okhks assigned to those. But I do on the Numeric keypad. As, that is essentially the habit I have built from my previous DAMN app. I assign tags using a okhk. Trying for as fluid of a process as possible, so I am assigning a lot of keys. I do understand the downsides of this method. But this way, the macros are one step (from me) and done. Once this is fleshed out more, I may go back and consider multi step macros where I feel they make sense.
In this case, however, I wanted to assign a shift-{key}. and yea, your point is quite valid and clear.
Though, disappointing that the system does not report if a text field element is active. Especially considering if it reports whether a menu item is. I suppose though, in most cases, it would be the script or the macro that does the activating.
Thinking now, that I want to build some foot pedals that act as the modifier keys.
Cheers!
Ñ
Hey Chris,
One thing that might be helpful to you is that keypad number keys are different from their same-named key on the regular keyboard.
So you can go-to-town on the keypad and still type numbers with the regular keyboard.
-Chris
Chris,
Agreed, that is exactly how I am working it. It would be handy however to have the system recognize whether or not it is in a text field.
That not withstanding, I do understand that there are limitations to what can be done.
Cheers!
Ñ
True – take it up with Apple if you dare.
Feedback - macOS - Apple
-Chris
1 Like