Re: Automatically sort a list ?
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.