g2g
10th November 2006 13:02 UTC
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
niteflyer
10th November 2006 13:08 UTC
Which error message do you get ?
Maybe you have forgot to quote:
!if "$license" == "license_german.txt"
niteflyer
10th November 2006 13:14 UTC
Looks like license is a variable. You cannot evaluate a (runtime-)variable at compile-time.
g2g
10th November 2006 13:17 UTC
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
kichik
10th November 2006 13:24 UTC
!include LogicLib.nsh
#...
${Switch} $LANGUAGE
${Case} ${LANG_GERMAN}
File german.txt
${Break}
${Case} ${LANG_ENGLISH}
File english.txt
${Break}
${EndSwitch}
g2g
10th November 2006 13:56 UTC
Hi @ll;
it works!
thank you so much for your assistance.
Regards
g2g
dandaman32
10th November 2006 14:36 UTC
!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
kichik
10th November 2006 15:08 UTC
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.