Skip to content
⌘ NSIS Forum Archive

Bug or error in script ( IntCmp)

3 posts

BioDuo#

Bug or error in script ( IntCmp)

Well for some reason, yet unknown to me.
The following script will jump each time to "install"
is it a bug in IntCmp that it can't reconise a '.' in it
or is it something else?

Function .onInit

StrCpy $0 "1.64"

IntCmp $0 1.65 install old 0
IntCmp $0 1.71 install 0 new

old:
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 "Older version" IDYES install
Abort

new:
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 "Newer version" IDYES +2
Abort

install:
FunctionEnd
Pidgeot#
Int signifies an integer. Since your numbers have decimals, they're not integers, and IntCmp won't work.

You should be able to use StrCmp instead.
deguix#
No, those are version numbers. There are functions in the wiki that compare between version numbers, but I can't access the wiki right now to indicate them to you.