Old 28th June 2007, 11:57   #1
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Question OutFile string doesn't accept variable

Hello again!

The OutFile string doesn't accept variable. But it will accept global name defined with !define.
code:
...
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
pospec is offline   Reply With Quote
Old 28th June 2007, 12:17   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Here we're again...

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

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th June 2007, 12:42   #3
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Ooops! Any suggestions what shall I do?

!define MUTACE_ $MUTACE ?
pospec is offline   Reply With Quote
Old 28th June 2007, 12:51   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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}"

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th June 2007, 13:54   #5
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
but that won't reflect my variable $MUTACE, am I right?
pospec is offline   Reply With Quote
Old 28th June 2007, 14:18   #6
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
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
demiller9 is offline   Reply With Quote
Old 29th June 2007, 07:40   #7
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
OK, I can use a !defined symbol instead of variable.

I have tried following:
code:
Name "${APP_NAME} ${PRODUCT_VERSION} ${MUTACE}"
OutFile "Output\DopravniDenik${PRODUCT_VERSION}${MUTACE}Setup.exe"


Now I call:
code:
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]
pospec is offline   Reply With Quote
Old 29th June 2007, 08:15   #8
aemik
Member
 
Join Date: Jun 2007
Location: Böblingen
Posts: 94
I have the same problem.
Is there no easy way to put an variable into the Outfile command?
aemik is offline   Reply With Quote
Old 29th June 2007, 08:21   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Pass /DMUTACE before the script name. The parameter processing is sequential.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 29th June 2007, 08:24   #10
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
I am DUMB! I've red about the sequentional processing before 5 minutes.

Thank you very much!
pospec is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump