• 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: Sort Order
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sort Order


  • Subject: Re: Sort Order
  • From: Luther Fuller <email@hidden>
  • Date: Thu, 10 Jan 2008 11:02:22 -0600

On Jan 8, 2008, at 5:45 PM, Christopher Nebel wrote:
On Jan 8, 2008, at 1:05 PM, Luther Fuller wrote:

This isn't causing a problem at the moment, but I curious ...

I have a folder containing number-named folders in OS X 10.4.11.
The Finder visibly sorts these folders in list view in the order ...
{_B, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, 27,28,29,30,31,A}
Which is alpha-numeric ordering.


I have an AppleScript that gets a list of these folders sorted by name.
I can clearly see the folders being processed in the order ...
{1,10,11,12,13,14,15,16,17,18,19,2,20,21,22,23,24,25,26,27,28,29,3,30 ,31,4,5,6,7,8,9,_B,A}
which is alphabetic ordering.


Is this an over-sight? Or is there a mysterious reason for this? Is this a latent bug?

Traditional lexicographic ordering (what you call "alphabetic") is how AppleScript has always worked, so we haven't changed it. (It's not wrong, but it is a different set of rules than you want.) However, there was a "considering" attribute added in Tiger that changes the traditional ordering to consider numeric sequences the way Finder does. Try enclosing your sort routine in this:


	considering numeric strings
		...
	end

I've just done a little experimenting. It seems that 'considering numeric strings' is not involved.
The code ...


set itemList to (sort (items of testTarget) as alias list by name) -- sorts alpha-numerically

always returns an alpha-numerically sorted list. But the code ...

set itemList to (items of testTarget) as alias list -- sorts alphabetically

returns an alphabetically sorted list. My test script did not use 'considering numeric strings'.

It seems that the default sort order is "alphabetical by name",
while the explicit sort-by-name order is "alpha-numeric".

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Sort Order
      • From: Christopher Nebel <email@hidden>
References: 
 >Sort Order (From: Luther Fuller <email@hidden>)
 >Re: Sort Order (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: tell or not to tell
  • Next by Date: Quark 731 Leopard Breaks Stylin
  • Previous by thread: Re: Sort Order
  • Next by thread: Re: Sort Order
  • Index(es):
    • Date
    • Thread