I was building this to see if I could autopopulate an excel spreadsheet with some data that I could then try to manipulate but I got pretty hung up on this part so I'm glad I finally got it.
Maybe someone else would find this useful, I'm new to AHK so apologies if I did stuff in weird ways. I looked around but I didn't see anybody did exactly something like this. It seems weird to me you have to create a second variable for the second loop and you can't name it the same as the first variable. How do you do something like n = n + 1 then? I'm more used to how it is in Java, this language is a whole 'nother ballgame for me!
Code: Select all
#SingleInstance Force
n := 10 ;
Arr := Array() ;
Loop %n%
{
Random rand, 1, 100 ;
R_%A_index% := rand ;
}
str = %R_1% ;
n1 := n - 1 ;
loop %n1%
{
index := A_index + 1 ;
str1 := R_%index% ;
str = %str%`, %str1% ;
}
msgbox, % str ;