Old 4th May 2012, 17:18   #1
Junior Member
Join Date: May 2012
Posts: 2

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
Var /GLOBAL caption
!include FileFunc.nsh
${GetOptions} $CMDLINE "/p" ${caption}

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

Last edited by athalow; 4th May 2012 at 18:02. Reason: help
athalow is offline   Reply With Quote
Old 4th May 2012, 18:44   #2
Afrow UK
Afrow UK's Avatar
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Your syntax/code is wrong.
${GetParameters} $R0
${GetOptions} $R0 "/name=" $caption

You don't use curly parenthesis for variables.

Afrow UK is offline   Reply With Quote
Old 7th May 2012, 12:25   #3
Junior Member
Join Date: May 2012
Posts: 2
thanks for the response.
Yes it seems that {} are only for the constants
athalow is offline   Reply With Quote
Old 7th May 2012, 13:25   #4
Major Dude
Join Date: Oct 2006
Posts: 1,892
Actually ${} are for defines, not constants. Constants are things like $PROGRAMFILES. http://nsis.sourceforge.net/Docs/Chapter4.html#4.2.3
MSG is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

arguments, global, product_name, variable, visibility

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump