2012-12-11 35 views
0

我想要一個applescript項目的列表,但我添加的東西是多字的字符串。當我嘗試查看讓我的列表中的項目1時,它最終成爲列表中的所有項目。我從重複做這個,這可能會有所作爲,但我很困惑,所以你認爲任何可以發佈的東西都可以發佈。 謝謝!字符串列表applescript

回答

3

以下是您的操作方法。這顯示了2種重複循環以及您如何使用它們。祝你好運!

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 
+0

您是否知道將其他項添加到列表末尾的正確方法? – user1685192

+0

將myList的結尾設置爲「另一個項目」...您應該到此處(http://macscripter.net/viewtopic.php?id=25631)並執行名爲「AppleScript初學者教程」的教程。這是我學到的。有一個列表。 – regulus6633

相關問題