• 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: Automatically sort a list ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically sort a list ?


  • Subject: Re: Automatically sort a list ?
  • From: Thomas <email@hidden>
  • Date: Mon, 27 Jan 2003 00:10:22 +0100

Thanks Ben, I think this will do the trick. Actually it seems like iTunes give me the list of every playlist by creation date.

Thanks Thomas

Ben Waldie (AppleScript Guru) wrote :

Here's a subroutine from the AppleScript web site, which will sort a
list of strings. You can pass your playlist to it...

set the composer_list to {"Ellington", "Copland", "Bach", "Mozart"}
return ASCII_Sort(the composer_list)

on ASCII_Sort(my_list)
set the index_list to {}
set the sorted_list to {}
repeat (the number of items in my_list) times
set the low_item to ""
repeat with i from 1 to (number of items in my_list)
if i is not in the index_list then
set this_item to item i of my_list as text
if the low_item is "" then
set the low_item to this_item
set the low_item_index to i
else if this_item comes before the low_item then
set the low_item to this_item
set the low_item_index to i
end if
end if
end repeat
set the end of sorted_list to the low_item
set the end of the index_list to the low_item_index
end repeat
return the sorted_list
end ASCII_Sort

Thanks,

- Ben

Benjamin S. Waldie
AppleScript Guru

http://www.applescriptguru.com
http://www.applescripttraining.com
_______________________________________________
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: 
 >Re: Automatically sort a list ? (From: Ben Waldie (AppleScript Guru) <email@hidden>)

  • Prev by Date: Re: Automatically sort a list ?
  • Next by Date: Re: [OT] AppleScript scripts versus Shell scripts
  • Previous by thread: Re: Automatically sort a list ?
  • Next by thread: Re: Automatically sort a list ?
  • Index(es):
    • Date
    • Thread