Before proceeding with installation I would like to give the user the option of uninstalling the app, if it has previously been installed. Here is my attempt below:
Function .onInit
; $R0 contains the path to the uninstaller
IfFileExists $R0 +1 NoPriorInstall
MessageBox MB_YESNO "Existing App installation found. Installation cannot proceed unless App is uninstalled.$\r$\nUninstall App?" IDYES UninstallApp
Abort
UninstallApp:
ExecWait $R0
NoPriorInstall:
FunctionEnd
It works however the non-modal "Permanently remove App" YESNO dialog pops up at the same time as the non-modal "App Setup" wizard so that its possible to install the app before uninstalling it or the other way round.
I'd like to either have:
ExecWait
would pause the installer but it doesn't), orI hoped running the uninstaller R0
I would like to run the app uninstaller if one exists, i.e. if the app is already before
You need invoke the old uninstaller with the special _?= parameter if you want to wait on it. If you do this, you have to delete the uninstaller yourself after it has finished.
You can find my full example of this on the wiki.