Trigger Macro by Name - Limit to Smart Group Results?

Is it possible to limit the search scope of a Trigger Macro by Name action to a Smart Group?

I know that you can set the initial search to, for example, ap: to filter by app-specific macros. The trouble is, unless you remember to hit โ†’ when the prompt appears, typing will overwrite that term, and your search will include global macros too.

I don't think so -- I believe Smart Groups are an Editor, rather than an Engine, construct.

1 Like

I noticed that too. I trigger the KM shortcut via another app and add โ†’ in that macro. This way I can start typing directly. In my case this app is BTT. But I'm sure there are other free app that can do this. Maybe Automator? Or Alfred?

Hey @noisneil/@Nige_S ,

There is hope. Check this out. :slight_smile: That superstar guy (@gglick ) taught me this a few years ago. Please see the below again.

AppleScript for Macro List.kmactions (3.6 KB)

As you can see the #Home Automation is the group. Yes.. it works the way you think.... I think. :wink:

Added::: Iโ€™m guessing this can be used on the other thread as well.

KC

1 Like

Is "#Home Automation" actually a Smart Group, rather than a normal Macro Group? Because I've never been able to get the macros in a Smart Group using AS, and the dictionary suggests it shouldn't be possible:

macro group n : A macro group.
elements
contains macros; contained by application.

...versus:

smart group n : A smart group.
elements
contained by application.

Thanks for the responses.

I'm not by my machine at the moment, so I can't check if @kcwhat's suggestion bears fruit. @Frankb's suggestion would work, but if I can find a way to avoid having extraneous text in the search field (ap:, for example), that would be preferable.

Oh darn. I simply used it on a regular group and not a smart group. I stand corrected @Nige_S. I think I carried the thought over from the other thread. Sorry for the mishap.

@noisneil Just the arrow (โ†’). The rest is KM native :slight_smile:

Yeah I get that. If there's no better solution, I can live with it, but ideally there'd be nothing in the search field when the prompt appears.

Sorry, not sure I understand. If you don't want anything in the search field, then don't write anything in "Initial search". :slightly_smiling_face:

The only way to filter by application/global availability is to have ap: or gl: in the search field. This seems a little inelegant to me, but not the end of the world. The ideal scenario would be to be able to select Smart Groups, as you can any other groups, but evidently it's not an option. So, what I should have said in my last comment was:

Ah, I see, you would prefer nothing to be there. But if there is nothing there, the search can't be narrowed. There are problems for which there is no ideal solution, unfortunately :man_shrugging:

That isn't quite true, because you can narrow by group here:

I wondered why narrowing by Smart groups wasn't also an option in that same menu. I've opted for your approach, and it's good enough.

1 Like

Make a feature request to Peter.

That might be unexpectedly complex to implement, but he's the one who would know.

Sorry to bother you @peternlewis, but what you reckon?

Actually, the Trigger Macro by Name action works fine with Smart Groups, it is just, err, hard to set them.

Add a macro group, and then drag a macro Smart Group over the added macro group to replace it with the smart group and it should work fine.

I'll look at fixing the UI so you can select it appropriately.

4 Likes

Fixed for the next version.

Also, it's easier than dragging, just add anything, and then select from the resulting popup menu and the option to select the Smart Group is now available in the menu.

1 Like

I take it back... I'm happy to have bothered you!

That's great! Thanks, @peternlewis!

Edit:

Hmm... Not sure what's going on here. I've created two smart groups:

CleanShot 2022-10-24 at 10.43.02@2x
CleanShot 2022-10-24 at 10.43.36@2x

I've set up a macro that will list all active macros available...

  • in the current app: ยง
  • globally: โŒฅยง

Trigger Macro by Name.kmmacros (28 KB)

Macro screenshot

For some reason, it still pre-fills the Initial Search field with ap:, so when you attempt to show all globally available macros, the list is empty:

Possible bug? @peternlewis

I would guess either the text is still in the Initial search field (maybe hidden by a newline or something?), or you are confused about the action you are running?

It wont be getting the "ap:" from the smart group, so the fact that it is getting it means it is still in the action that is being run.

I'd have thought the same thing, but:

CleanShot 2022-10-25 at 10.17.14