• 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: Newbie problem with lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: scripting explorer
  • Next by Date: Is it possible to get owner name and use it to mount an volume
  • Previous by thread: Re: newbie problem with lists
  • Next by thread: Re: Newbie problem with lists
  • Index(es):
    • Date
    • Thread