6
我有我的循環不同長度的字符串列表:如何獲取Applescript中循環的索引?
set my_list to {"abc", "defg", "hi", "jklmno"}
repeat with the_item in my_list
-- get index of the_item
end repeat
我如何才能找到the_item的指數,而我循環?
我有我的循環不同長度的字符串列表:如何獲取Applescript中循環的索引?
set my_list to {"abc", "defg", "hi", "jklmno"}
repeat with the_item in my_list
-- get index of the_item
end repeat
我如何才能找到the_item的指數,而我循環?
您可以引入一個計數器,並通過循環與每次迭代更新:
set counter to 0
repeat with the_item in my_list
set counter to counter + 1
-- do stuff
end repeat
repeat with n from 1 to count of my_list
-- do stuff with (item n of my_list)
end repeat
破碎的鏈接?重定向到Apple支持。 – 2013-07-02 23:17:22