Re: Neat strategies for sorting a list of files alphabetically by name
Re: Neat strategies for sorting a list of files alphabetically by name
- Subject: Re: Neat strategies for sorting a list of files alphabetically by name
- From: Brennan <email@hidden>
- Date: Tue, 15 Mar 2005 08:47:13 +0100
On 14/3/05 at 11:01, Adam Wuellner <email@hidden> wrote:
> Finder will give you 'name of theFiles' if theFiles is a list
> of Finder's file class objects. You say you have a droplet,
> and when the files are dropped on the droplet, the list comes
> in as a list of aliases... is that a correct formulation of
> the problem?
It's correctly formulated as the flaw in Barry's solution.
The original problem is "How do I get a list of files (which may be
aliases or finder file objects or strings or any fairly standard class)
into a script in alphabetical order.
I'm also interested in sorting files in general, and it surprises me that
there is no built-in file sorting available to Applescript without going
to the shell or making a sort routine in script code.
Oddly enough 'list folder' (Standard Additions) does an alphanumerical
sort.
What I'm actually doing is making m3u files - i.e. text files containing
(in this case local) URLs so that I can listen to some audiobooks and
spoken word compilations in QuickTime Player. There are reasons why I
don't wish to use iTunes for this job. In particular the m3u files can be
uploaded to a server and play via the QuickTime browser Plugin.
> > Conceivably I could assume that 'selection of app "Finder"'
> > will contain a list of the same files as received by 'open',
> > but I fear that this may not always work. Can I rely on this?
>
> Perhaps - I assume this thought comes from the fact that in
> order to drop a group of files on the droplet, first (in fact,
> immediately prior) they must be selected in Finder... As long
> as the 'get selection of application "Finder"' happens rather
> quickly in the on open handler, I would be pretty confident
> that the state of that selection had not changed. However, I
> would be more confident working with only the data that was
> originally supplied - the list of aliases.
That was my feeling too. Naturally someone or something could call 'open'
with any old parameter. Unlikely, but possible. Someone may also select
something else very quickly after dropping the files on the droplet.
I now have a solution which is working well for me. It's not foolproof,
but it works if I stay within certain operational limits.
Many thanks Adam and Barry for your help
Brennan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden