Archive: problem with checking if installed


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:


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

Originally posted by xabbu
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.