Skip to content
⌘ NSIS Forum Archive

question on logiclib

4 posts

jsbach#

question on logiclib

i have:
...
var Var1
var Var2
...
${If} $Var1 <> $Var2
; do action 1...
${Else}
; do action 2...
${EndIf}

When values are different i expect 'action 1' being executed but this never happens. for example:
Var1 = "1.3.1.0"
Var2 = "1.4.1.0"

i'm getting 'action 2' executed. Why ?

thanks.

ps. not yet tried with latest version of logiclib (just downloaded). Now using lib which comes with nsis 2.06.
onad#
Please give amore complete example what you do e.g. how do you assign the values to Var1 and 2

surly NOT with :

Var1 = "1.3.4.5"

because that will not work 😉
glory_man#
If you want compare 2 versions use "VersionCompare" scripts. Search for forum and NSIS Archive.
For example this link.
jsbach#
found why

thanks for the two replies: paying more attention at logiclib.nsh description i understood my error was not to use the right comparison command:
<> for signed integer tests (built-in);
!= for string tests (built-in);
S!= for case-sensitive string tests (using System.dll);
S> for case-insensitive string tests (using System.dll)
and so on...

So the right working code becomes:

${If} $Var1 S> $Var2 ; (or $Var1 != $Var2 if i want to check just differences)
; do action 1...
${Else}
; do action 2...
${EndIf}

And about versions compare, specific UDFs maybe fine but logiclib, when used properly, could be just enough in most cases.

thanks.