for "loop" 0 to object.count - 1
set aray(loopindex("loop")) to object(loopindex("loop")).X
or
for "loop" 0 to object.count - 1
pick object by nth (loopindex("loop"))
set aray(loopindex("loop")) to object.X
Eventualy you can make a previous pick above the loop.
like: pick objects who's instance variable is 1
then it runs only trough those objects