Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   detect has already been installed (http://forums.winamp.com/showthread.php?t=255525)

peeratep 15th September 2006 05:57

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

Animaether 15th September 2006 07:46

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

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

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.

PHP Code:

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...

PHP Code:

StrCmp $"" _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 /newerthan the current version.
goto 
_continue 

_continue
:
the rest of the code to continue with 


kichik 15th September 2006 11:22

Quote:

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

Animaether 15th September 2006 11:54

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! :)


All times are GMT. The time now is 04:41.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.