Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 15th September 2006, 05:57   #1
peeratep
Junior Member
 
Join Date: Sep 2006
Posts: 28
detect has already been installed

how to check previous version install when setup!
peeratep is offline   Reply With Quote
Old 15th September 2006, 07:46   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
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 
Animaether is offline   Reply With Quote
Old 15th September 2006, 11:22   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Quote:
Originally posted by Animaether
( slashes "/" should be backslashes "\" - darn php tag. )
Use the code tag instead.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 15th September 2006, 11:54   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
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!
Animaether is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump