How Can We Help?
< All Topics

How do I increment an array variable within a loop

How do I increment an array variable within a loop, so that in the first loop the result is saved to variable %T[1]%, in the second loop the result is saved to %T[2]%, in the third loop the result is saved to %T[3]%, etc.?

The first step is to create an Integer variable such as %N[1]% and set it to the value of 1. Place the command before the repeat loop in the script.

Within the loop, save the result to %T[%N[1]%]%. Before the End Repeat insert a Variable Modify Integer command and increment the value of variable %N[1]%.

The second time through the loop, %N[1]% will have a value of 2, so that the result is saved to %T[2]%, and so on.

– Applies to: Macro Express 5 and Macro Express Pro