Archive: MUI_PAGE_LICENSE with a variable (not another LANG select)


MUI_PAGE_LICENSE with a variable (not another LANG select)
Hi,

i ve searched the forum for MUI_PAGE_LICENSE and Licensed explanation in order to use a different EULA file depending on a variable in a compilation command :

makensis /V2 /DOutFile="..\Dist\Setup.exe" /DResLicName="LicenseFile" setup.nsi

Then in the setup.nsi :


...
!ifndef ResLicName
!define ResLicame "AnotherLicenseFile"
!endif
...
!insertmacro MUI_PAGE_LICENSE "$(ResLicName)-cluf.rtf"
or
!insertmacro MUI_PAGE_LICENSE "${ResLicName}-cluf.rtf"
or
!insertmacro MUI_PAGE_LICENSE "$ResLicName-cluf.rtf"


When compiling project i have the following error :

LicenseData: open failed "$(ResLicName)-cluf.rtf"
Usage: LicenseData local_file_that_has_license_text | license_lang_string
Error in macro MUI_PAGE_LICENSE on macroline 21
Error in script "setup.nsi" on line 93 -- aborting creation process

I read the forum about using a different EULA file from lang string but that's not my case, i also read that variables was not possible ?

Is there a (simple) way to solve my problem ?

Thanks all.

EDIT :
i va tried

!insertmacro MUI_PAGE_LICENSE "$(ResLicName)"


and have the error :

LangString "ResLicName" is not set in language table of language English
LangString "ResLicName" is not set in language table of language French

${ResProdName} is a define more info
e.g. !define ResProdName "${NSISDIR}\license.txt"
!insertmacro MUI_PAGE_LICENSE "${ResProdName}"
Also take a look here Command Line Usage


Well i've found a solution in another thread in forum (saying to read Multilanguage.nsi from \NSIS\Examples\Modern UI !)

makensis /V2 /DOutFile="..\Dist\Setup.exe" /DResProdName="Different App" setup.nsi


...
!ifndef ResProdName
!define ResProdName "My App"
!endif
...
!insertmacro MUI_PAGE_LICENSE $(ResLicName)
...
LicenseLangString ResLicName ${LANG_FRENCH} "${ResProdName}-cluf.rtf"
LicenseLangString ResLicName ${LANG_ENGLISH} "${ResProdName}-cluf.rtf"


All MUIs for LANG were already set in my script.

It works as expected, but this workaround is effective if i don't use different language EULA

Hi Red Wine,

i m sorry there was a bug in my script file i first posted (i should have posted original one...).
ResProdName = ResLicName (i ve edited my post).
In my second post i have separated ResProdName and ReslicName because when compiling script the command Line /DResprodName define the name of the application and ResLicName get the EULA file name associated to.
Hope it is clear ! ^^


well,

Red Wine, you gave me an important clue so i tried :

makensis /V2 /DOutFile="..\Dist\Setup.exe" /DResProdName="Different App" setup.nsi


!ifndef ResProdName
!define ResProdName "Default App"
!endif

!define ResLicName "${ResProdName}-cluf.rtf"

!insertmacro MUI_PAGE_LICENSE "${ResLicName}"


So it works without having to use LicenseLangString workaround and the different syntax

But what if i had to set for my different license apps diffrent license lang too ?

I'm not sure what exactly you're trying to achieve,
perhaps this:

!ifndef ResProdName
!define ResProdName "Default App"
!endif

!if ${ResProdName} == "Different App"
!define ResLicName "D:\Licenses\Lic_FRA.rtf"
!else
!define ResLicName "D:\Licenses\Lic_ENU.rtf"
!endif

!insertmacro MUI_PAGE_LICENSE "${ResLicName}"

ResProdName in the compilation command line give me the name of the CLUF/EULA file to display (i have created those files). They are both in french but the name of the file is different depending of the ResProdName. I don't need now, but i was wondering what if i had to display one of these file depending of the given variable AND language :

For the moment i have :

/DResProdName="App01"
ResLicName would be App01-cluf.rtf

/DResProdName="App02"
ResLicName would be App02-cluf.rtf

What if i would like :

/DResProdName="App01"
ResLicName would be App01-cluf_FRA.rtf when french is selected
or
ResLicName would be App01-cluf_EN.rtf when english is selected

/DResProdName="App02"
ResLicName would be App02-cluf_FRA.rtf when french is selected

or
ResLicName would be App02-cluf_FRA.rtf when english is selected.

Well, this part would be next step and maybe will never occur !


!ifndef ResProdName
!define ResProdName "Default App"
!endif

!if ${ResProdName} == "App_01"
!define ResLicName "D:\Licenses\Lic__01.rtf"
!endif

!if ${ResProdName} == "App_02"
!define ResLicName "D:\Licenses\Lic__02.rtf"
!endif
!if ${ResProdName} == "Default App"
!define ResLicName "D:\Licenses\Lic_DEFAULT.rtf"
endif

!insertmacro MUI_PAGE_LICENSE "${ResLicName}"


All the above are compile time commands.

The Language selection is a runtime action depented on the end user, thus you have to set the different lang strings at runtime according to the end user's selection.

/DResProdName="App01"
ResLicName would be App01-cluf_FRA.rtf when french is selected
or
ResLicName would be App01-cluf_EN.rtf when english is selected

/DResProdName="App02"
ResLicName would be App02-cluf_FRA.rtf when french is selected

or
ResLicName would be App02-cluf_FRA.rtf when english is selected.
use this:


!ifndef ResProdName
!define ResProdName "Default App"
!endif

!if ${ResProdName} == "App_01"
!define ResLicName "D:\Licenses\Lic__01.rtf"
!else if ${ResProdName} == "App_02"
!define ResLicName "D:\Licenses\Lic__02.rtf"
!else
!define ResLicName "D:\Licenses\Lic_DEFAULT.rtf"
!endif

LicenseLangString ResLicFile ${LANG_ENGLISH} "${ResLicName}-cluf_EN.rtf"
LicenseLangString ResLicFile ${LANG_FRENCH} "${ResLicName}-cluf_FRA.rtf"

!insertmacro MUI_PAGE_LICENSE "$(ResLicFile)"