Archive: detect has already been installed


detect has already been installed
  how to check previous version install when setup!


When you install, write the version number to the registry when done installing, e.g.

( slashes "/" should be backslashes "\" - darn php tag. )

WriteRegStr HKCU "Software/YourCompany/YourProduct/" "version" "version number" 

( above can be in the last section, or in .onInstSuccess, or.. etc.

Then when you run the installer, check for that value, e.g.

ReadRegStr$0 HKCU "Software/YourCompany/YourProduct/" "version" 

The version number will then be in $0. If the key did not exist, it'll just be empty. So you can do some rudimentary things with it...


StrCmp $0 "" _noPreviousInstall

IntCmp$0 current_version _sameVersion _olderVersion _newerVersion

_noPreviousInstall:
;insert code to execute here when there has been no previous installation.
>goto _continue

_sameVersion:
;insert code to execute here when the old installed version is the same as the current version
goto _continue

_olderVersion:
; insert code to execute here when the old installed version is older than the current version
goto _continue

_newerVersion:
;insert code to execute here when the old installed version is /newer/ than the current version.
>goto _continue

_continue:
;the rest of the code to continue with
>

Originally posted by Animaether
( slashes "/" should be backslashes "\" - darn php tag. )
Use the code tag instead.

haha.. yeah, we've been over this before (I was gone for a while) - I like the highlighting of PHP.

There should really be an NSIS tag added so syntax highlight while keeping the [code] formatting. I know, I know.. "will you write it?".. if I could! :)