Archive: OutFile string doesn't accept variable


OutFile string doesn't accept variable
Hello again!

The OutFile string doesn't accept variable. But it will accept global name defined with !define.

...
Var MUTACE
!define PRODUCT_VERSION "3.45"
...
OutFile "Output\DopravniDenik${PRODUCT_VERSION}$MUTACESetup.exe"
...
Function .onInit
${If} ${DDVERZE} == "CD"
StrCpy $MUTACE ""
${Else}
StrCpy $MUTACE "SD"
${EndIf}
FunctionEnd
...


The output file is then DopravniDenik3.45$MUTACESetup.exe. Am I doing something wrong?

Edit: I forgot - the Name instruction works fine with $MUTACE

Here we're again...

OutFile is a compile time instruction hence does not accept variables whom usage takes action at runtime.


Ooops! Any suggestions what shall I do?

!define MUTACE_ $MUTACE ?


Yep a definition should work fine if it is a valid path/file name defined.

E.g. !define MY_OUTPUT "C:\NSIS Projects\My New Project\Setup.exe"
.....

OutFile "${MY_OUTPUT}"


but that won't reflect my variable $MUTACE, am I right?


The variables get their values only when the script executes. '.onInit' won't execute and $MUTACE will not have a value, so you cannot use it in the OUTFILE command.

You can use '!if' preprocessor commands to select '!defines' to execute or skip and modify the name based upon conditions that you detect during the compile.

Don


OK, I can use a !defined symbol instead of variable.

I have tried following:

Name "${APP_NAME} ${PRODUCT_VERSION} ${MUTACE}"
OutFile "Output\DopravniDenik${PRODUCT_VERSION}${MUTACE}Setup.exe"

Now I call:
makensis script.nsi /DMUTACE="SD"

Output is still DopravniDenik1.0${MUTACE}.exe. Maybe I don't understand you, but in makensis help is written:
/Ddefine[=value] defines the symbol "define" for the script [to value]

I have the same problem.
Is there no easy way to put an variable into the Outfile command?


Pass /DMUTACE before the script name. The parameter processing is sequential.


I am DUMB! I've red about the sequentional processing before 5 minutes. :cry:

Thank you very much!