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

Re: Open Dialog Sort Order


  • Subject: Re: Open Dialog Sort Order
  • From: Mr Tea <email@hidden>
  • Date: Mon, 15 Dec 2003 22:38:36 +0000

This from Pat Stanford - dated 15/12/03 8.58 pm:

> When I use a script to get a list of files in a folder it comes in in
> normal expected ASCII order. When I look at the same folder in the open
> file dialog, it is sorted differently. Why? How can I get a list in my
> script that will match the Finder display on screen?


Hi.

Of the two lists you posted, the one returned by AppleScript is in strict
alpha-numeric order, while what you see in the Finder window is the Finder's
attempt to sort the files 'intelligently' - ordered according to the
integers coerced from the beginnings of the file names (so that 2 comes
before 10, 20 before 150, etc - in previous Mac OSes the files would have
been displayed in the same rigid alphanumeric order in your script result,
making leading zeros a must when numbering large numbers of sequential
files).

Unless there's a shell routine to do this (some sort of dark and greppy
necromancy, probably) you'll need to repeat the Finder's trick by plucking
numbers from the beginning of file names. In your list, no filename starts
with more than three digits, so I would start by trying to get 'text 1 thru
3 as integer'. If that errors, try it with 'text 1 thru 2' then just text 1.
Then you have a list of numbers you can juggle into the correct order with a
convenient handler (generously provided by a more knowledgeable scripter
than myself... any minute now... ).



Nick
pp Mr Tea

--
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Open Dialog Sort Order
      • From: Mr Tea <email@hidden>
References: 
 >Open Dialog Sort Order (From: Pat Stanford <email@hidden>)

  • Prev by Date: Re: Corrupt Script
  • Next by Date: Re: Selecting boxes in Quark
  • Previous by thread: Open Dialog Sort Order
  • Next by thread: Re: Open Dialog Sort Order
  • Index(es):
    • Date
    • Thread