Re: Differentiating between "A1", "A12", "A13"
Re: Differentiating between "A1", "A12", "A13"
- Subject: Re: Differentiating between "A1", "A12", "A13"
- From: Arthur J Knapp <email@hidden>
- Date: Fri, 11 Jan 2002 16:44:14 -0500
>
Subject: Re: Differentiating between "A1", "A12", "A13"
>
Date: Fri, 11 Jan 2002 00:56:59 +0000
>
From: Nigel Garvey <email@hidden>
>
Arthur J Knapp wrote on Thu, 10 Jan 2002 15:30:11 -0500:
>
>> From: Nigel Garvey <email@hidden>
>
>> set myFolder to choose folder
>
>
>
>> -- Get the names of all the files in the folder
>
>> -- (Hopefully, they're in alphabetical order)
>
>
>
>> tell application "Finder" to set nameList1 to name of files of myFolder
>
> I'm surprised at you, Nigel ;-)
>
> tell application "Finder"
>
> set theFiles to sort (every file of myFolder) by name
>
... only returns an alphabetical sort of the *files*. You then have to
>
examine each one in turn to get its name, which is very tedious on my
>
4400. This:
Whoops, I'm surprised at myself...
>
> set theNames to sort (name of every file of myFolder) by name
>
>
... returns an empty list, which is fairly useless - but it does speed up
>
the rest of the script enormously! ;-)
Alright, wiseguy, I screwed up, screwed up bad. ;-)
How about a hack:
tell application "Finder"
-- DEBUG
activate
set theFolder to choose folder
-- -----
set theFiles to sort (every file of theFolder) by name
end tell
set theNames to FilenamesFromFinderObjects(theFiles)
on FilenamesFromFinderObjects(aFiles)
try
err of aFiles
on error str
end try
set text item delimiters to {"file \""}
set str to str's text items
set text item delimiters to {"\""}
set aNames to {}
repeat with x from 2 to str's length
-- Faster than sending AppleEvents for each file.
--
set aNames's end to str's item x's text item 1
end repeat
return aNames
end FilenamesFromFinderObjects
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://members.bellatlantic.net/~bswaldie/>
on error number -128
end try
}