Old 1st July 2010, 09:55   #1
xabbu
Junior Member
 
Join Date: Jul 2010
Posts: 1
Exclamation problem with checking if installed

Hello,

I've a little problem.

What I want:
I want the installer to check what version is installed and if it is newer the old version should be uninstalled. if not do nothing and if you have installed a newer version it should inform you.

my way to do it:

code:

Function .onInit
ClearErrors
; Check to see if SEP sesam is installed (we need it)
; uninstall old version first!
ReadRegStr $R1 "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "DisplayVersion"
${VersionCompare} $R1 "${PRODUCT_VERSION}" $1
!define PKEY "$R1"
IntCmpU "$1" "1" newer noupdate uninst
uninst:
ClearErrors
Exec $INSTDIR\uninst.exe ; instead of the ExecWait line
noupdate:
MessageBox MB_OK|MB_ICONEXCLAMATION "${PRODUCT_NAME} ist bereits in der Version ${PKEY} installiert!$\n$\nEs ist kein Update nötig!"
Abort
newer:
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} ist in einer neueren Version installiert!$\n$\nEs ist kein Update nötig! \
Wenn Sie die alte Version istallieren wollen$\n$\ndrücken Sie `OK` oder `Abbrechen` um das Setup zu verlassen." \
IDOK uninst
Abort
done:

FunctionEnd



my problem is that the version check works but then the installer run the unint-part and and runs forward to the noupdate-part.

But first he should deinstall the old software, after that he should start the installation of the new files.

I also tryed goto done after the exec but than the installer starts at the same time.
Same when I use ExecWait.

Any idears?

Thanks
Xabbu
xabbu is offline   Reply With Quote
Old 1st July 2010, 10:28   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by xabbu View Post
my problem is that the version check works but then the installer run the unint-part and and runs forward to the noupdate-part.
[...]
I also tryed goto done after the exec but than the installer starts at the same time.
Same when I use ExecWait.
These are two different problems. You need the goto done, for obvious reasons. The installer not appearing to wait for the uninstaller to finish has been explained many times in these forums. I suggest you use the search function.
MSG is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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