KM11 %FinderSelection(s)% and %FinderInsertionLocation% Results are inconsistent, possible bug?

Hi! I'm getting inconsistent results in a bunch of my macros. I've narrowed it to the use of the %FinderSelection% %FinderSelections% and %FinderInsertionLocation% tokens.

This simple test macro is giving me inconsistent results. Sometimes it will get both the selected item(s) and insertion location, and sometimes it will get just the selected item(s) and sometimes it will get neither.

Edit: I'm seeing similar behavior with other Tokens: %FrontBrowserURL% as well.
I tried Restarting, Removing and Re-Added KM and KM Engine from accessibility security pane.

Peter is aware of issues with the %FinderSelections% token, I reported it yesterday. The other tokens may be a related issue.

Long story short, he made adjustments to the underlying code that those tokens use to prevent it from running for longer than 0.5 seconds. So with a large number of items, it doesn’t finish completing before it times out. He may adjust it with a future update.

See my topic below ↓
Possible Bug: %FinderSelections% Token Returns Inaccurate Results When Selecting Large Number of Items - Questions & Suggestions - Keyboard Maestro Discourse

1 Like

Hi @cdthomer thanks. I saw that. This is happening when i'm running this macro on a single item selected in finder, which i wouldn't imagine would take more than .5 seconds.

I just added actions to measure the time it takes to run the token actions and i'm definitely getting this behavior when it's less than .5 seconds.

1 Like

Interesting... tagging @peternlewis so he sees this post.

This could be the same issue as discussed in this thread:

It is possibly related to the version of MacOS you are using. I’ve also reported it separately to Peter.

Out of interest what macOS are you on?

Ah. That user's experience squares with mine. I'm also running Monterey (12.7) and also seeing the flashing in the editor for many tokens.

Seems that @peternlewis is aware of the issue then. Apologies for not doing a more thorough search! Going to downgrade for now.


None needed - I rolled back to KM 10.2 several days ago and problem went away. Hopefully there’ll be a fix before too long!

Yes, there are two different issues in the FinderSelects.

One issue is a problem with Pre-Ventura systems where the results are intermittent. This is resolved for the next version.

One issue is a limitation on how long the token is allowed to take. I've increased it from 0.6 to 0.9 seconds, but realistically the token needs to be more or less instant, so if you want to deal with very long lists, then use the Finders Selection collection.


Thanks Peter for your help on this (and my related post). It hadn’t even occurred to me to use the Finder Selection collection. I’ll look at migrating my macros over to that action!

1 Like

I don't know if this is related, but I'm experiencing something similar when I use %SafariURL%.

When I get the prompt, it's empty

This seems to be an issue with version 11, because in version 10 it was working as expected

I am using KM11 and the %SafariURL% token is working for me.

So, %SafariURL% gets the address of the currently open page in Safari.

In your screenshot, it looks like Safari isn't open at a page.


When Safari is open at a page it should look something like this in the preview at the bottom.


Also, just for future reference, you can quote %SafariURL% directly in the prompt rather than setting it first to a Variable.

Yes, it's showing on KM, but sometimes it goes away for some reason. That screenshot was probably when it went away.

But the issue is there even when Safari is the front window and in version 10 it was always working.

I tried your suggestion of using the %SafariURL% directly on the prompt and it seems to be working now. Let's see if it works from now on. Still, there's something with version 11 that's causing this. Maybe related to macOS as well, because it seems that version 11 with older versions of the macOS is the issue, not just version 11 itself.

Ok it seems that the issue is still there even with %SafariURL% directly in the prompt

Kapture 2023-11-01 at 14.57.12

To quickly test any token to check if it is working easily, you can also use the Value Inspector which evaluates the token in real time.

1 Like

Thanks for sharing that tip.
My issue now is that I can see the url on the action itself. When I try the macro, it doesn't work. It's probably related to the issue reported by the OP, because this macro was working prior to upgrading to version 11

1 Like

I experience the same token-related problem that work on KM 10 but not on KM 11. Look like need to wait for next release of KM.