Skip to content
⌘ NSIS Forum Archive

how to compare two numbers?

12 posts

Noobico#

how to compare two numbers?

how to compare two numbers???
or how to get a number from the registry?

is there something like

if(a<b)
{
MessageBox......

????

how do you compare if you don´t do it like that???

iam new to nsis... i just have some knowledge about c++
Noobico#
hm i just saw strcmp.... but i wanna read the registry entry in as a number i did that a look at the documentation...

and comparing two numbers??? i didn´t find that either...

maybe iam just blind but i can´t find it
Noobico#
thx and sorry....

i really have been blind...
i have to get into it..

thx for you patience
i appreciate that
Afrow UK#
Sorry, it's me that never had any patience.
I would usually have helped you a lot more, but it's too late (time) 🙁

I will be able to help you better tomorrow. 🙂

-Stu
Noobico#
it´s no prob...
i will hit you if i can´t get it to work...

i installed nsis yesterday and it´s really hard in the beginning...

so sorry if i seem to be a bit dumb...
Noobico#
another thing....

is there a chance to compare two numbers which
are float??? cause all versionnumbers got something
like 1.05 or something like that...

and i don´t think IntCmp can do that cause it only does take
only "whole" numbers...
at least in c++ this would be right....
Joel#
I use StrCmp like this:

StrCmp "1.26" "1.056" 0 +3
MessageBox MB_OK "Equal"
goto +2
MessageBox MB_OK "No Equal"
pengyou#
There is a script in the Archive that might do what you want:

"Basically it contains a small function called VersionCheck which correctly compares two dotted notation version strings (e.g. 3.5 and 3.5.1.4) and indicates which of the two is the higher version."

Noobico#
thx... that could be the answer...
if not i could use version numbers without dots...

but i will test it