Can i use a variable as a part of the name of another variable?

Lets say i have a macro like this

store | “google.com”, url1
store | “facebook.com”, url2
store | “twitter.com”, url3
store | “youtube.com”, url4

if i have 100 different urls, from url1 to url100

can i have a while loop that increases the variable name?

like this:

while_v2 | ${n} <= 100

store | “newurl”, url${n}
executeScript_Sandbox | return Number (${n}) + 1, “n”
endWhile

i try to create 100 new variables from url1 to url100 and store newurl on them.

is this possible?

What if you instead write it all to a CSV file?

Then you have the ability to read any row from the CSV file.

Will that work?

not feasible cause it will slowdown the macro a lot, i have almost 40 if-while loops checking variables one by one, i want to make only one loop that cicles thought variables, as every variable i have ends with a number, url1 url2… url40 i thought the smart way to do is change dinamically the end of the name of the variable to reuse the same loop, i tried to do it with arrays url[x] but it seems kantu doesnt support arrays.

UI Vision supports regular Javascript arrays.

The difference between Javascript variables/arrays and UIVision variables is that you have to use the executeScript_Sandbox command instead of store. But it is super powerful!

1 Like

Thank you, ill give it a look

Full array support arrived with V5.5.6, see Arrays in UI vision