Reputation: 43
I've scoured for an answer to this and I can't seem to find one (or at least one that I understand).
Is it possible to run an applescript loop with a looping variable within?
For example - let's say I wanted to rename each item in a list using another list:
set myFirstList to {"1", "2", "3"}
set mySecondList to {"A", "B", "C"}
repeat with i in myFirstList
--change '1' to 'A', change '2' to 'B', etc
set name of i to first item of mySecondList, then second item of mySecondList, ???
end repeat
Upvotes: 0
Views: 464
Reputation: 11238
I think that you want is...
set myFirstList to {"1", "2", "3"}
set mySecondList to {"A", "B", "C"}
set myFirstListCount to count myFirstList
repeat with i from 1 to myFirstListCount
set item i of mySecondList to item i of myFirstList
end repeat
return {myFirstList, mySecondList}
Upvotes: 3