Skip to content
⌘ NSIS Forum Archive

I have a query???

5 posts

TonyDS#

I have a query???

Hi I have a little query

I have this in my script

The first part of the onInit lines works fine, thats not the problem

First it check the Reg to see if the program I am patching is version 2.02

If not it give you the message to update and quits

When the update has been install My program then installs

Thats fine it works, like I said

It's the seccond part of the onInit lines, once my patch is installed, if you try to install it again, it checks the Reg for the second part of the onInit script

It checks to see if my version is 1.0, if it is then you get the message saying that it has already been installed and quits

Function .onInit
ReadRegStr $0 HKLM "Other Software\v1.0" "Version"
IntCmp $0 1 +1 +1 +3
MessageBox MB_ICONINFORMATION|MB_OK "WARNING: Your version of Blah has not yet been updated to version 2.02.$\n$\nPlease install the update,/$\n$\nbefore attempting to install ${MUI_PRODUCT} ${MUI_VERSION}"
Abort
ReadRegStr $0 HKLM "Software\My Application\${MUI_PRODUCT}" "Version"
IntCmp $0 1 +1 +3
MessageBox MB_ICONINFORMATION|MB_OK "${MUI_PRODUCT} ${MUI_VERSION} has already been installed"
Abort
FunctionEnd 
This is the line I put in for the second part of the onInit line to check the Reg
WriteRegStr HKLM "Software\My Application\${MUI_PRODUCT}\" "Version" "${MUI_VERSION}" 
Q1. My actual query is, are the numbers correct next to the IntCmp line in the second part of the onInit lines, sorry but the numbers confuse me a little, not really knowing what they mean. I know it explains it in the help file, but could someone explain to me in laymans terms what they actually mean and used for, please.

Q2. I tried changing the version of my script to version 2.0 to see if the program would install on top of the 1.0 version, like I said it first checks the Reg to see if version 1.0 has been installed. but I just get the message that the program has already been installed.

Q3. What would I have to change so that version 2.0 installs on top of version 1.0

Thanks in advance

-Tony
TonyDS#
Thanks for the quick responce, but it didn't work

I'm not too bothered as it was only a query and the script works fine

All I really want to know is what the numbers means
Afrow UK#
IntCmp works like this

IntCmp $0 $1 if$0=$1 if$0<$1 if$0>$1

I'm too tired to think right now.
Maybe you should do another IntCmp for checking 2.0 and 1.0 versions

-Stu
TonyDS#
So basically its 0 1 if 0 equals 1, if 0 less than 1, if 0 greater than 1

Thanks I that make sence now

Anyhow I was seaching through the forum and found a thread so I adapted the script


Function .onInit
ReadRegStr $1 HKLM "Software\\My App\${MUI_PRODUCT}" "Version"
StrCmp $1 "${MUI_VERSION}" 0 continue
MessageBox MB_ICONINFORMATION|MB_OK "${MUI_PRODUCT} ${MUI_VERSION} has already been installed."
Abort
continue:
FunctionEnd 
This works just fine

Thank you anyhow