Archive: How to put $0 = NAME$1, where NAME$1 is a defined variable and $1 is another variable


How to put $0 = NAME$1, where NAME$1 is a defined variable and $1 is another variable
Okay the title sounds quite confusing but here it is.

I used NSIS random number generator (generating a random number from 0 to 100) to POP to $1.
I've defined the variables NAME0, NAME1..... all the way up to 100 using e.g. !define NAME0 = Joesam
So from $1, i want to be able to StrCpy $0 NAME$1.

However, no matter how i try to do it, I can't make $0 be the name that i want (joesam or whatever). It always comes out as NAME1 or NAME2 etc, whether i use any combination of ${} or others.

Can anyone help? Any help would be greatly appreciated. Thanks!


This will not work because the constants NAME0 etc are no longer so in the built installer. By that time they have all been evaluated to their defined values.

What you are trying to do requires arrays, which you can use the NSISArray or Stack plugins for. You could also write all your values to the registry or an INI file instead of using plugins.

Stu