In article <2008042815593316807-phantom@[EMAIL PROTECTED]
>, Phantom
<phantom@[EMAIL PROTECTED]
> wrote:
> I'm wondering if anyone here knows of an elegant way to eliminate
> duplicate values from an applescript list.
>
> e.g. taking this list:
> {"apple", "orange", "apple", "watermelon", "orange"}
>
> and returning
> {"apple", "orange", "watermelon"}
>
>
> not a big priority, but it would help with one of my scripts. could't
> find a answer with google, unfortunately, sorry to bother if this comes
> up a lot.
>
> thanks guys.
Try this:
set list1 to {"apple", "orange", "apple", "watermelon", "orange"}
set list2 to {"apple", "orange", "watermelon"}
set list3 to {}
repeat with x from 1 to count of items of list1
set n to item x of list1
if n is in list2 and n is not in list3 then set end of list3 to n
end repeat
return list3
--
Help improve usenet. Kill-file Google Groups.
http://improve-usenet.org/


|