• 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: Christopher Nebel <email@hidden>
  • Date: Tue, 8 Jan 2008 15:45:19 -0800

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


--Chris Nebel AppleScript Engineering

_______________________________________________
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: Luther Fuller <email@hidden>
References: 
 >Sort Order (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: file sorting via applescript?
  • Next by Date: Photoshop CS3 and clipping paths
  • Previous by thread: Sort Order
  • Next by thread: Re: Sort Order
  • Index(es):
    • Date
    • Thread