• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File Order Processing Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Order Processing Question


  • Subject: Re: File Order Processing Question
  • From: Dave Lyons <email@hidden>
  • Date: Wed, 21 Sep 2005 17:17:36 -0700

Finder's "sort ... by name" (10.4 and later) uses the same order you would see in View > as List, when sorted by name, which does do numeric sorting (by following standardized Unicode rules, as implemented by the API UCCompareTextDefault). I don't know that any particular order is guaranteed for the "items of <folder>" list.

Cheers,

--Dave

On Sep 21, 2005, at 2:18 AM, pete boardman wrote:

On 20 Sep 2005, at 16:55, Oakley Masten wrote:

I don’t understand how AppleScript processes files in a folder.

Me neither. :-)

I want it to process them in alphabetical order but it uses some other criteria.

You can investigate sort orders in the Finder using a script like this: (10.4.2 Tiger required, I think).


--
set f to (choose folder)
set r to {}
tell application "Finder"
set s1 to items of f -- default Finder order
set s2 to sort (items of f) as alias list by name -- sort command
repeat with i from 1 to count s1
set end of r to name of (item i of s1) & tab & (name of item i of s2) & return
end repeat
end tell
r as Unicode text
--


With a file full of ordinary alphabetical names, I've seen little difference between the columns. But files with numerical names, leading spaces, or names with punctuation sort very differently. For example:

1.txt    1.txt
10.txt    2.txt
11.txt    3.txt
2.txt    4.txt
3.txt    5.txt
30.txt    6.txt
4.txt    7.txt
5.txt    8.txt
6.txt    9.txt
7.txt    10.txt
8.txt    11.txt
9.txt    30.txt

Perhaps someone knows a reference for this.

hth

Pete
_______________________________________________
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


  • Follow-Ups:
    • Re: File Order Processing Question
      • From: pete boardman <email@hidden>
References: 
 >File Order Processing Question (From: Oakley Masten <email@hidden>)
 >Re: File Order Processing Question (From: pete boardman <email@hidden>)

  • Prev by Date: Re: new folder
  • Next by Date: Re: Perhaps OT: how to make a custom CD that opens upon insertion to a window with custom background and icons
  • Previous by thread: Re: File Order Processing Question
  • Next by thread: Re: File Order Processing Question
  • Index(es):
    • Date
    • Thread