Re: Newbie problem with lists
Re: Newbie problem with lists
- Subject: Re: Newbie problem with lists
- From: email@hidden
- Date: Thu, 6 Jun 2002 10:42:15 +0100
You could either write a routine that does a bubble sort, going along the
list looking to see if item n>item (n+1). If true, set a flag. Repeat this
loop until the flag doesn't get set.
eg
-- Code starts here
set flag to false
set x to count of mylist -1
repeat
repeat with i from 1 to x
ignoring case -- optional
if item i of mylist > item (i+1) of mylist then
set temp to item i of mylist
set item i of mylist to item (i+1) of mylist
set item (i+1) of mylist to temp
set flag to true
end if
end ignoring
end repeat
if flag is true then
set flag to false
else
exit repeat
end if
end repeat
--end of code
Alternatively, you could use an OSAX - there's loads of them at
www.osaxen.com. The one I use is ACME Sort at
http://www.osaxen.com/acme_script_widgets.html
Steve
_______________________________________________
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.