Very helpful! Thank you. Has already saved me minutes, and will save me hours before the end of next week.
I’ve never penned a line of code, so I just typed what shows in your image into “Script Editor” (I assumed there would some such in OS X), hit “Compile” (which nicely formatted it as you show it, confirming that while I can not write, I am a good copyist), and pasted it into the KM Action “Execute AppleScript” (which rudely removed all the nice formatting — how did you get yours to keep it?). But it works.
It also made me aware of something — something which programmers must have the vocabulary to describe. Because I don’t write code, my use of KM is almost entirely based on mimicking user actions. The AppleScript you provided does not mimic user actions, and my existing KM macro, which creates a new folder with the same base name as the file and moves that file into it, and which I wanted to run on the selected files in Path Finder, immediately failed. (I was able to find a suitable KM macro that Peter had provided to a knowledge-seeker on this forum.)
In short, I was looking for something that literally ( ) moved the current selection from one file in Path Finder to the next file among a group of specified-by-selection files. What you provided supplies, one by one, something that is recognized as each file, without, afaict, doing anything visible in the UI at all.
What is the term for the distinction — or the distinct approaches — I’m trying to limn above?
More importantly, how does KM know to treat the file path/name as a file, and not as text? It just seems quizzical to me that I can tell KM to, per your example, “open” this string, and it opens a file.
I’m always learning. Thanks.