Archive: error with if command


error with if command
Hi @ll;

I have a problem with the if command.
That´s the code.


LicenseLangString license ${LANG_ENGLISH} "sce_data\license_english.txt"
LicenseLangString license ${LANG_GERMAN} "sce_data\license_german.txt"

!if $license == "license_german.txt"
File "sce_data\license_german.txt"
!else
File "sce_data\license_english.txt"
!endif

I use HM NIS Editor, but there is no syntax highlighting for the !if command. The !else and the !endif is recognized as a command and as so highlighted by the editor.
What´s wrong with it?

Have anybody an idea?
Thanks

Regards
g2g

Which error message do you get ?
Maybe you have forgot to quote:

!if "$license" == "license_german.txt"


Looks like license is a variable. You cannot evaluate a (runtime-)variable at compile-time.


Hi niteflyer;

yes, it´s a variable.
all I want is depending on the selected language (german or english) copy the accordingly license file to the install directory.
How can I realize that?

Regards
g2g


!include LogicLib.nsh
#...
${Switch} $LANGUAGE
${Case} ${LANG_GERMAN}
File german.txt
${Break}
${Case} ${LANG_ENGLISH}
File english.txt
${Break}
${EndSwitch}

Hi @ll;

it works!
thank you so much for your assistance.

Regards
g2g


!if is a compile-time command. Using it at run-time will inevitably produce ill effects.

Kichik: NSIS needs LogicLib-like commands implemented natively. It seems that nearly all NSIS scripts (incl. Firefox, etc.) plus many of your code examples are using it, so it might be wise if this functionality was implemented natively, or if a simple "!include LogicLib.nsh" was added into the default makensis.nsh.

BTW say hi to my dad for me, he's in Jerusalem Nov. 16-17 on business :D look for the skinny guy with the Philips hat that lifts 35-pounders and was gray at age 23 :p

-dandaman32


Higher level scripting language would be nice, indeed.

Lucky him for not coming over this weekend... The city was packed with cops. You couldn't move an inch without bumping into one.