Only in the Spotlight window

I would like a few "typed string triggers" to only work when typed in the Spotlight window.

If I have understood correctly, KM does not recognize this window. Is there another way to do this? Thank you!

Could you activate the typed string trigger macros when you hit your Spotlight hotkey and then deactivate them on Enter/Escape?

Mm, sorry, I'm afraid I don't understand the questions ... my bad English.

What I would like to do is this.

Double tap cmd, activates the spotlight window. Then I want to type for example "s space space" to trigger something. But only in this window. The same string (not in this window) triggers something else.

The simplest solution would be, if window "name" is in front, do that, if not do something else.

This is the sort of thing I was suggesting:

Spotlight - Typed String Triggers.kmmacros (40 KB)

Macro screenshot

...however, it turns out you can test for the existence of the Spotlight window using AppleScript:

Spotlight - Typed String Trigger (Example).kmmacros (40 KB)

Macro screenshot

I like your second solution very much, thank you @noisneil.

BTW, do you see any reason not to do something like below?

Edit: Ah, the string is also deleted if it is not typed in the Spotlight window. But you don't have to delete it.

Yep looks good.

Thank you. I'm not quite sure yet, but since I use Spotlight anyway, I can also trigger macros with it. At the moment that seems like a good idea :slightly_smiling_face:

1 Like