0

I am trying to have a list of applescript items but the things i'm adding are strings with multiple words. When I try to view lets say item 1 of my list, it ends up being all of the items in the list. I'm doing this from a repeat which might make a difference but I am very confused so anything that you think might work just post it. Thanks!!!

4

1 回答 1

3

Here's how you do it. This shows 2 types of repeat loops and how you use them. Good luck!

set myList to {"some words", "more of them", "and a lot of words"}

repeat with i from 1 to count of myList
    set thisItem to item i of myList
    -- do something with thisItem
end repeat

-- or another way to do a repeat loop

repeat with anItem in myList
    set thisItem to contents of anItem
    -- Notice if we use a repeat loop like this (e.g. anItem) then anItem
    -- is just a reference to the words. To actually get the words
    -- we need to get the contents of anItem
end repeat
于 2012-12-11T05:46:49.430 回答