Efficient Way to Iterate Through a Variable Array

I'm going to pose my question as a suggestion/request...

I would like to use the For Each action to iterate through a variable array. So, the flow of the macro might read...

For Each array item in the collection of array items in the variable variable array, do some actions.

I don't see that this is possible using the For Each action, but I hope it makes my intent clear. What is the most efficient way to iterate through a variable array?

If it's simply building the macro using an increasing variable as the index, that's fine, I can do that. No need to respond with examples. Just want to make sure I'm not overlooking some action, like For Each, that might be more efficient.

Would "The Lines In" work?

Where each line is essentially one array item with a line break essentially being the delimiter.

But, each line would need to be used as a calculation. (Each line would be the coordinates of a found image.)

Hi @Jamag,

Have you looked at the Variable Arrays section on wiki?

For array of array, you probably have to use the Custom Array Delimiter.
Use different Custom Array Delimiter for different levels.

1 Like

Hey John,

Sure, but scope out @martin's suggestion too.


1 Like

Yes, I have looked at the Variable Arrays section of the wiki. My perception of that section infers the need to build out a macro in a "conventional" way where the iteration is "manually" accomplished by iterating through an array using an increasing index variable. (I did imagine accomplishing this using a Custom Array Delimiter.)

Seems to me, though, that "The Lines In" would be a more efficient way to iterate through data, as long as the lines can be interpreted as numeric values, rather than as text.

I'm realizing that, since the indexing isn't essential (I don't need to access particular indexes of data. E.g. Accessing index position 2, then 4, then 1, etc.), that "The Lines In" might be perfectly fine.


OK. "The Lines In" worked just fine. I used one macro to build the set of data (where each line in a variable is the coordinates of a found image location formatted as X,X,X,X). Then another macro uses The Lines In the variable to paste another image over the middle of each found image's coordinates.

If anybody's interested, I can post the macros. (Though they are rather hammered out and not well documented...signed, The Busy Life of a Teacher)

1 Like