Old 4th January 2012, 15:25   #1
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
Create custom ${IF}... Test

Hi all,

i hope my headline is somewhere in the vincinity of being correct of what i will describe now, if not i hope you can still help me

I want to create my own "string" that i can use with the ${IF}..${ENDIF} clause. For example with logiclib you can use

code:

${IF} ${silent}
#do stuff
${ENDIF}



i want to create my own ${silent}, in my case it should be:

code:

${IF} $InstallPartOfApplication = 1
#do stuff
${ENDIF}



so "$InstallPartOfApplication = 1" should become ${InstallPartOfApplication)

code:

${IF} ${InstallPartOfApplication)
#do stuff
${ENDIF}



now if $InstallPartOfApplication = 1 or not would be defined from a license file that is read during the beginning of the installation.

I hope (lots of hoping in this one) i could post my question understandable, and somebody can help me.

Btw. i looked at examples in the x64.nsh, which frankly i do not understand also looking at the silent part of logiclib.nsh did not bring me any step ahead i still wonder how _silent can be referenced from the !define below it....


!macro _Silent _a _b _t _f
IfSilent `${_t}` `${_f}`
!macroend
!define Silent `"" Silent ""`

Thanks a lot.
x
xbarns is offline   Reply With Quote
Old 4th January 2012, 15:45   #2
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
As oh so many times, i might have come up with my own solution.

Please advise if that would be a good way to do what i want

code:


${IF} "LicensefilecontainsfeatureX"
!define InstallFeatureX `1 = 1`
${ELSE}
!define InstallFeatureX `1 = 0`
${ENDIF}

${IF} ${InstallFeatureX}
#do stuff
${ENDIF}



Thanks
x
xbarns is offline   Reply With Quote
Old 4th January 2012, 16:21   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That is not valid semantics. The code will not compile (have you even tried it?) You want:
code:
!define InstallPartOfApplication `$InstallPartOfApplication = 1`
Stu
Afrow UK is offline   Reply With Quote
Old 5th January 2012, 07:07   #4
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
The code does compile, i have tried it

I will use your example anyway, it makes more sense

Thanks.
xbarns is offline   Reply With Quote
Old 5th January 2012, 10:40   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
Originally Posted by xbarns View Post
The code does compile, i have tried it
Just for clarity, the exact code you posted, i.e.
code:

${IF} "LicensefilecontainsfeatureX"
!define InstallFeatureX `1 = 1`
${ELSE}
!define InstallFeatureX `1 = 0`
${ENDIF}

will definitely not compile.

Stu
Afrow UK is offline   Reply With Quote
Old 5th January 2012, 12:42   #6
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
Talking

Oh (of course ) you are right, this was a try of showing what i want to accomplish. With the "it compiles" i was referring to the 1 = 1 part.

Thanks for your help
xbarns is offline   Reply With Quote
Old 5th January 2012, 19:17   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,451
Just creating a define is ok for this sort of thing, but you if require more logic you need a macro, those last two macro parameters are the jump labels for true/false...

IntOp $PostCount $PostCount + 1
Anders 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