i am relatively new to applescript, and although i am very fluent in other languages i cannot figure out how to use a call on a list…
for example… i have a list set Mylist to {“1”,“2”}
now how do i have a repeating loop which steps through a different element in the list each time around? or better yet how do i access individiual elements in a list… in perl its as easy as $array[0]… but how you do it in applescript is beyond me.
: i am relatively new to applescript, and although i am very fluent
: in other languages i cannot figure out how to use a call on a
: list…
: for example… i have a list set Mylist to
: {“1”,“2”}
: now how do i have a repeating loop which steps through a
: different element in the list each time around? or better yet
: how do i access individiual elements in a list… in perl its
: as easy as $array[0]… but how you do it in applescript is
: beyond me.
Accessing individual items is as easy as referring to “item 2 of myList” etc.
To repeat you have several choices. Here are a couple:
set Mylist to {"1", "2"}
repeat with i from 1 to (count Mylist)
-- do whatever you want in here, for example...
display dialog (item i of Mylist)
end repeat
OR…
set Mylist to {"1", "2"}
repeat with anItem in Mylist
-- do whatever you want in here, for example...
display dialog anItem
end repeat
Is this what you meant??
Bill