pospec
28th June 2007 11:57 UTC
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
Red Wine
28th June 2007 12:17 UTC
Here we're again...
OutFile is a compile time instruction hence does not accept variables whom usage takes action at runtime.
pospec
28th June 2007 12:42 UTC
Ooops! Any suggestions what shall I do?
!define MUTACE_ $MUTACE ?
Red Wine
28th June 2007 12:51 UTC
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}"
pospec
28th June 2007 13:54 UTC
but that won't reflect my variable $MUTACE, am I right?
demiller9
28th June 2007 14:18 UTC
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
pospec
29th June 2007 07:40 UTC
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]
aemik
29th June 2007 08:15 UTC
I have the same problem.
Is there no easy way to put an variable into the Outfile command?
kichik
29th June 2007 08:21 UTC
Pass /DMUTACE before the script name. The parameter processing is sequential.
pospec
29th June 2007 08:24 UTC
I am DUMB! I've red about the sequentional processing before 5 minutes. :cry:
Thank you very much!