Skip to content
⌘ NSIS Forum Archive

boolean comparison

14 posts

Noude#

boolean comparison

Hellow !


Please I need help because I don't know how to do a boolean comparison in a !if.

In C code I do it like this:
if ((a == b) || (b == c) || (c == d) || (d == e))

But in Nsis I really don"t know how to do this, I read the doc but... 0_o

I've tried everything in my code but it's don't work.

Please heeeeelp ! =)

Thanks !
Noude#
I think it's runtime comparisons.

I explain you, the comparison is done according to the settings in a customized window
Afrow UK#
All the LogicLib syntax is explained in the header file itself (Include\LogicLib.nsh).

${If} ...
${OrIf} ...
...
${EndIf}

Stu
Noude#
=) =) =) (I said that's runtime ! =( snif...)

ok I will read the header file.

I'll be back after eating and reading the file 🙂

Thanks !
MSG#
Originally Posted by Noude View Post
=) =) =) (I said that's runtime ! =( snif...)
LogicLib is used for runtime functionality: The commands are evaluated when the installer is being run (so, at runtime). The LogicLib defines however are of course evaluated at compiletime (when the installer is being compiled), just like all other defines are evaluated at compiletime.

So while the ${defines} of LogicLib are compiletime magic, the actual functionality deals with runtime. Otherwise, you could never do this:
${If} $Variable == "test"
...because, $Variable is only given a value at runtime. The compiler won't have a clue what its value will end up being, so it cannot be a compiletime command.
Noude#
Reeee !

So I have to use the LogicLib but how can I do with my variables ? 0_o

I have to compare variables at a moment !
Noude#
I just read the LogicLib.nsh and .nsi

But there're just examples to do if a <= b or if a != b...
No example with || or && :/

Really I don't know how to do ...
MSG#
if ((a == b) || (b == c) || (c == d) || (d == e))


${If} $a == $b
${OrIf} $b == $c
${OrIf} $c == $d
etc
etc

How can that be too difficult? o_O
Noude#
because I do not always understand how to do with compiltimne and runtime... arf, sorry.

Yes, it's not difficult at all but... 0_o

Thank you a lot ^^
Noude#
But I can't do :

${If} ((toto == Yes) && (toto == No) && (toto == No) && (toto == No)&& (toto == No))

???

I can only give 4 parameters to the ${If} ??


because if I do:

${If} $a == $b
${OrIf} $b == $c
${OrIf} $c == $d

I'm dead :/
Netsurfer24#
Originally Posted by Noude View Post
because I do not always understand how to do with compiltimne and runtime...
It is quite easy.

Everything starting with a "!" is compiletime and
everything starting with "$" is runtime.

BTW: You should have a look at the helpfile (NSIS.chm) in your ${NSISDIR}.

Gunther