Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 字符串列表applescript_String_Macos_List_Applescript_Repeat - Fatal编程技术网

String 字符串列表applescript

String 字符串列表applescript,string,macos,list,applescript,repeat,String,Macos,List,Applescript,Repeat,我正在尝试创建一个applescript项目列表,但我要添加的内容是包含多个单词的字符串。当我尝试查看列表中的项目1时,它将成为列表中的所有项目。我是从一个重复的角度来做这件事的,这可能会有所不同,但我很困惑,所以任何你认为可行的事情都可以发布出来。 谢谢 以下是您的操作方法。这显示了两种类型的重复循环以及如何使用它们。祝你好运 set myList to {"some words", "more of them", "and a lot of words"} repeat with i fr

我正在尝试创建一个applescript项目列表,但我要添加的内容是包含多个单词的字符串。当我尝试查看列表中的项目1时,它将成为列表中的所有项目。我是从一个重复的角度来做这件事的,这可能会有所不同,但我很困惑,所以任何你认为可行的事情都可以发布出来。
谢谢

以下是您的操作方法。这显示了两种类型的重复循环以及如何使用它们。祝你好运

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

这是你怎么做的。这显示了两种类型的重复循环以及如何使用它们。祝你好运

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

您知道将另一项添加到列表末尾的正确方法吗?请将myList的末尾设置为“另一项”。。。您应该到这里()学习名为“AppleScript初学者教程”的教程。我就是这样学的。有一个用于列表。你知道将另一项添加到列表末尾的正确方法吗?将myList的末尾设置为“另一项”。。。您应该到这里()学习名为“AppleScript初学者教程”的教程。我就是这样学的。有一个用于列表。