• 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: Record sorting routine
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Record sorting routine


  • Subject: Re: Record sorting routine
  • From: Emmanuel <email@hidden>
  • Date: Sun, 9 Feb 2003 11:00:27 +0100

At 1:40 PM -0600 08/02/03, Jerry Podhajsky wrote:
I have a list of records that I'd like to sort by a date field contained
in all the records. I'm trying to roll my own with Applescript, but
have come up short and very confused.

Does anyone have a basic Applescript routine (I'm trying to avoid an
OSAX, so that I can see the code and maybe learn something) that takes a
list of records and sorts them by a specified field in the record?

A solution could be that you use the "sort" handler which is provided in the Class Scripts/Application file of the distribution of Smile. You copy the handler, you rename it, you rename the calls to itself that it contains ("sort" is recursive), you change the line which says "if x is lower than y" into your personal ordering test, et voila.

(Alternately you can use the "heapsort" routine which is located in the same file:
- "heapsort" is not recursive, so it's safer
- "heapsort" is a little slower on the average, but its execution time is much less variant
- "heapsort" can be tweaked easily to find - more rapidly - only the, say, 10 higher terms)

Smile is that editor and environment for AppleScript which is free:
<http://www.satimage-software.com/en/softx.html#smile>

Emmanuel
_______________________________________________
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.

References: 
 >Record sorting routine (From: "Jerry Podhajsky" <email@hidden>)

  • Prev by Date: Re: Testing if another app is running
  • Next by Date: Mail or Smile bug ?
  • Previous by thread: Re: Shell script and grep
  • Next by thread: Re: Record sorting routine
  • Index(es):
    • Date
    • Thread