- NSIS Discussion
- boolean comparison
Archive: boolean comparison
Noude
20th August 2010 10:46 UTC
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
20th August 2010 10:53 UTC
Yep I have include it but... 0_o
Afrow UK
20th August 2010 10:54 UTC
Are you doing run time or compile time comparisons?
Stu
Noude
20th August 2010 10:57 UTC
I think it's runtime comparisons.
I explain you, the comparison is done according to the settings in a customized window
Afrow UK
20th August 2010 10:59 UTC
All the LogicLib syntax is explained in the header file itself (Include\LogicLib.nsh).
${If} ...
${OrIf} ...
...
${EndIf}
Stu
Noude
20th August 2010 11:04 UTC
=) =) =) (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
20th August 2010 11:24 UTC
Originally posted by Noude
=) =) =) (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
20th August 2010 13:01 UTC
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
20th August 2010 13:16 UTC
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
20th August 2010 13:17 UTC
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
20th August 2010 13:21 UTC
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
20th August 2010 13:36 UTC
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
20th August 2010 13:39 UTC
Originally posted by Noude
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
Noude
20th August 2010 13:43 UTC
Yep I've just read it 2 seconds ago =) thanks :)