Selecting PathFinder files to operate on

In going through some of my Pathfinder-specific macros, I find that I have accumulated a variety of macros that select PathFinder files in different ways. There is one based on a script by Chris Stone"

Another based on a workflow by JMichael:

A third based on a JXA script by ComplexPoint:

And a fourth using only the native Pathfinder menu commands:

Leaving aside the error-checking and commenting in JMichael's (which are valuable and can presumably be replicated in the other approaches) and the fact that JMichael's is Finder/PF-agnostic, is there any reason that one of these approaches should be preferred to the others?

Personally, I use Chris’s method for many months or even year now. I don’t really know why. Perhaps because it was the first solution proposed in the forum. I do not remember. In any case, it works very well for me. And it’s short and easily understandable.

Short answer: No.

All of the core processing of the scripts is the same.
For example, examine my core script:

        set pfSelectionList to selection
        if pfSelectionList ≠ missing value then
          repeat with oItem in pfSelectionList
            set (contents of oItem) to POSIX path of (contents of oItem)
          end repeat

compare that with one of Chris’s scripts:

  # Get the selection as Path Finder objects.
  set selItemList to selection
  # Convert Path Finder objects to POSIX Paths
  repeat with i in selItemList
    set contents of i to (POSIX path of (contents of i))
  end repeat

Slightly different style, different variable naming conventions, but all materially the same.
Chris has been posting AppleScripts for decades, so chances are that my scripts are in some way derived from, or modeled on, his. I will say this about my PF scripts: they are scripts that I am actively using because I am using PF as my main finder app. So they get a lot of “testing” every day. LOL

So, pick whichever one you find must readable, most understandable, test it for your workflow, and then don’t worry about it. :smile:

Most of my PathFinder scripts are longer and more complex because:

  1. I try to use considerable error checking/handling for the scripts I publish so end-users (and myself) won’t get caught by surprise.
  2. My most recent PF scripts do multiple things:
  3. Allow one master script that can be used with either Finder or PF
  4. Work with either the main PF window, or one of its “Find” windows.
  5. Return either an alias or POSIX path
  6. Designed to work with a bunch of my other scripts like getting dates, setting dates, tags, etc.

But then, I’m sure Chris has scripts that do much the same. And I’m sure @ComplexPoint has his own system/lib that all works together well for him.

So, if anyone has specific questions, post them in the thread where the script was posted, and we will try to answer there.