Re: Trying to move away from Finder...


Shane Stanley
 

On 2 Nov 2017, at 10:29 am, Christopher Stone <listmeister@thestoneforge.com> wrote:

The thing to do is to use the best tool for the job
Defining best can be the issue, though. I suspect what most scripters really want is a single tool that may not be the fastest at everything, but is reliable, straight-forward to use, and fast enough.

There was a time when the Finder was mostly just that. Sadly, it now isn't, especially in terms of performance, so there's often a need to look elsewhere. That's where System Events was supposed to come in: it should have taken over the file management side of things, leaving Finder scripting for where you wanted to deal with Finder-specific issues, like window state or selections.

But System Events comes up short not least because it is largely limited to its own item/file/folder classes -- there's no equivalent to things like the Finder's "as alias list", so getting stuff out of it is more challenging than it should be. And it has its own quirks (a trivial example: it returns the wrong name for files containing a / character).

AppleScriptObjC offers the file manager, which is reliable and very fast -- but the learning curve is obviously substantial. It can be mitigated substantially by using libraries, but it's obviously not for everyone.

--
Shane Stanley <sstanley@myriad-com.com.au>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

Join applescript@apple-dev.groups.io to automatically receive all group messages.