Re: getting a file list in sorted order
Re: getting a file list in sorted order
- Subject: Re: getting a file list in sorted order
- From: has <email@hidden>
- Date: Mon, 19 Aug 2002 21:43:30 +0100
Paul Berkowitz wrote:
>
> No, really; most Finder scripting stuff seems to work just fine (if a bit
>
> slowly on OS8/9). Considering that a lot of AppleScript and AS-related
>
> stuff is buggy as anthills, this is not a bad track record.<g>
>
>
I have to weigh in here.
Oh shush, Paul; can't you see I'm trying to make a point here? ;p
(Can't remember what it was any more, but I'm sure there was some reason
for it...:)
>
There are a lot of pre-OS X AS versions out there.
>
Many of them have a LOT wrong with the Finder's AppleScripting.
I take it you mean there's a lot of pre-OS X Finder versions out there with
a lot wrong with their scripting interface. (See? See? This is just what I
was saying about the whole OS=Finder=AS mixup confusion thing. I rest [at
least one of] my case[s].;p)
>
The biggest problem I found with the classic Finder was in moving and
>
copying files, worse when re-naming was also required. The Finder would take
>
so long to return a result that the next line of code would move on and find
>
no file to work with, and error or give a wrong result.
I must confess: I've never experienced this problem for myself. (Maybe
because I've avoided the worst OS/AS combinations over the years? The
perils of speaking from personal experience; I guess mine has just been
much better than everyone else's.:p)
I don't think AS would ever move on while it's waiting for an application
response, however [it would be a massive, massive AS bug if it did, and a
shootable offence:]. Unless you explicitly tell it to ignore application
responses, it will wait until a response is received, or the wait times
out. Rather, it sounds like the Finder is returning a new object reference
before its entirely ready to handle any operations that the user wishes to
perform using that reference (tantamount to updating the object model used
by the scripting interface before finishing the actual filesystem changes).
(If there's a problem with duplicate [and duplicate and rename] that I'm
aware of, it's that the process too closely mirrors the way the graphical
side does it. Which is fine for point-n-click; much less so when you're
scripting it. But that's a feature [:p], not a bug.)
Hrm. Is there any specific/documented info on this problem I can go look up
the stuff you're talking about? I'd quite like to find out more details.
>
The other big problem in many versions of classic AS was simply trying to
>
get all the items of a large folder; and with recursion - forget it. The
>
script would just fold up and die.
[If you mean 'entire contents' then that was the Finder's fault, not
AppleScript's.]
The "fold up and die" thing is a characteristic of _any_ recursive routine
that calls itself too many times: the call stack has a finite capacity, and
if your program builds up too many unfinished calls then sooner or later
runs out of room (overflows). Nature of the beast.
on foo()
foo()
end foo
foo() -- go boom!
Not something you'd expect from a professionally coded bit of software like
the Finder, of course. On the other hand, if it's your own AppleScript code
that's doing it then you really have nobody else to blame but yourself.
>
I don't know if this may have improved in
>
later versions of OS 9: I had given up on it long before. 'list folder'
>
always worked, and Akua's 'the entries in' worked even better, and is much
>
more versatile. In OS X, I miss all the parameters of Akua's 'the entries
>
in' but otherwise am managing fine here.
You get the major options in a Finder 'whose' clause, so I imagine it's not
an issue in most cases. The other stuff's really more advanced than you'd
expect from the Mac Finder (e.g. regex matching), and are best left to
osaxen or OS X shell scripts [1] to do for those who really need them.
>
In any case, since
>
'process' returned with OS 10.1, I'm managing all right with the OS X Finder
>
and have begun to forget the previous traumas.
I can see the autobiography now ... "How I Fought AppleScript And Lived To
Tell The Tale!" (Bestseller, I guarantee.;)
Cheers,
has
[1] But a great opportunity for UNIX-savvy AS users to earn many brownie
points by stepping into the breach by writing AS libraries to wrap those
UNIX calls. 'Nuff said.
--
(My email address has changed from <email@hidden> to
<email@hidden>. Please update your address books accordingly.)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.