Hi Briter,
Welcome to the AutoHotkey community forums.
I see you already found the answer to your question. But just in case, here is some more info on using A_Index for recursive loops:
If used inside an inner loop, A_Index refers to the inner loop, if used inside an outer loop AND outside an inner loop, A_Index refers to the outer loop. You can also save the value of the outer loop for usage inside the inner loop by assigning A_Index to another variable before entering the inner loop. This is specially usefull when you wish to loop through a two dimensional object (such as a table).
Example usage (code below loops through all the values of ABC):
ABC := object()
ABC[1] := [1,2,3]
ABC[2] := [4,5,6]
Loop % ABC.MaxIndex() ; One iteration for each of the two rows.
{
CURRENT_ROW := A_Index ; This is how we save the values of the current iteration of the outer loop for use inside the inner loop.
Loop % ABC[1].MaxIndex() ; One iteration for each of the three columns.
{
msgbox % ABC[CURRENT_ROW, A_Index] ; Example: if we are at the second iteration of the outer loop and first of the inside loop, this call will dereference ABC[2,1], which is 4.
}
}