Archive: Dinamic globals


Dinamic PRODUCT_NAME
hi,good evening.
I'm new on nsis language,and i'm trying to create a "special" installer.
In that installer,i need to change the name of the app depending the commandline used to execute the installer.
An example must be installer.exe /name = musicplayer.

the problem it's that the productname it's declared outside any function/section,only declared by:

!define PRODUCT_NAME "example"

OnInit function i have the value of the argument passed,but i can't give it to the PRODUCT_NAME variable becouse it's a constant.So i tryed to declare OnInit:

Function .onInit
done:
Var /GLOBAL caption
!include FileFunc.nsh
${GetOptions} $CMDLINE "/p" ${caption}
FunctionEnd

but it can't be seen in other function/section like ${caption},neither out of function/section.

the case it's that i want to know if it's possible to on onInit set a global variable with the name passed as argument and acces it in any function/section/out and the syntaxis to access it.(for example in PRODUCT_NAME)

PD: thanks everybody


Your syntax/code is wrong.

${GetParameters} $R0
${GetOptions} $R0 "/name=" $caption
You don't use curly parenthesis for variables.

Stu

thanks for the response.
Yes it seems that {} are only for the constants


Actually ${} are for defines, not constants. Constants are things like $PROGRAMFILES. http://nsis.sourceforge.net/Docs/Chapter4.html#4.2.3