Variable naming

This is a very simple question. I came across the answer somewhere but can’t find it now. How can I generate variable names on the fly? I want to have variables called addr1, addr2, addr3, etc. for each iteration of a loop. I can create them as strings, but how do I reference the string as a variable?


Hi Jamal,

One way to set a string to a variable is with Akua Sweets ‘universal’ command. For example:

set x to "x1" universal x set with 15

After you run this in the Script Editor, you can access the value in the same script or another script with:

universal "x1"

which will return a result of 15. The value will remain until you change it, remove it from the global table, or shut down the computer (I think).