Open finder selection fails

This macro (and others like it) started failing a few weeks ago, maybe when I upgraded to Monterey. It's a time saver when it works, but now it doesn't. Any idea what's wrong? Is it a problem with the application? Doing the same thing from the context menu in Finder works, so I don't see why this does not.

Affinity Photo.kmmacros (2.0 KB)

That works if I select only ONE file to open. It fails if I select several, with the following message. The other method had no problem opening multiple files.

That’s because if you have multiple items selected in Finder you need to use this KM token instead: %FinderSelections%

Of course you’ll need to include logic in your macro to determine whether you need to use the singular or the plural version of the token…

Since I’m not at my Mac I can’t test this out for you so I can’t be absolutely confident that using the plural version will work. If you try it out yourself let us know how you get on.

More info on the token in the KM wiki here: token:FinderSelection [Keyboard Maestro Wiki]

Edit: I don’t know if %FinderSelections% can be used regardless of the number of items selected - that’s something I’ll look at myself (much) later if I get the time.

Following on from my previous post I've now had a look at using %FinderSelections% and found that if you don't know in advance how many items you're going to select in Finder, the approach that should work for you is illustrated in this snippet:

KM 0 2022-05-05_16-27-38

which executes the action coloured Green as many times as there are items selected in the Finder window. In your case, therefore, you would replace the green action with the Open action and use %Variable%LocalSelectedItem% as the file to be opened. It may be that Affinity Photo won't be able to keep up with KM trying to open a number of files in quick succession so you might need to insert a Pause in the loop.

Just to point out that this was caused by a bug in Monterey 12.3 and the bug is now fixed as of 12.3.1

So, in macOS 12.3.1 your Actions like this will work again.

1 Like

Not true. Both my Macs are on 12.3.1, and the open finder selection action doesn't work.

I’m sorry to hear that. The Action now works fine for me again (in 12.3.1)

I don’t have Affinity Photo but with the Apps I have it works. I will test again now just to be absolutely sure...

EDIT - Yes, I can't get it to fail. Even tried with multiple selected items in the Finder and a few different Apps (QuickTime, Photoshop, Illustrator, Preview).

Some kind of confounding between the action and Affinity Photo (and Designer) I suppose. I haven't needed it for other apps, so haven't tested that. Oh well. I'll try one of the other solutions posted above. Thanks!

1 Like

Affinity Photo had no trouble opening in quick succession with the old solution, and it works fine with yours, too. Thank you!

This is the macro now:

Affinity Photo.kmmacros (2.6 KB)

image

1 Like