Skip to content
⌘ NSIS Forum Archive

Delay Installer until unstall finishes?

2 posts

phungus420#edited

Delay Installer until unstall finishes?

I have my script set up pretty good, but one minor problem still remains. If there is a previous version, the automatic uninstaller trips fine, but the user can simply skip the uninstaller, install, then uninstall after the fact, which of course leads to the program simply being uninstalled. It's minor, I just note this and say to hold off and let the uninstaller finish and then install, but I'd rather have it automatically wait. Is there anyway to do this?

This is the current relevant script code:
Function .onInit

ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_LOC}" \
"UninstallString"
StrCmp $R0 "" done

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${NAME} is already installed. $\n$\nDo you wish to uninstall?" \
IDOK uninst
Abort

;Run the uninstaller
uninst:
ClearErrors
Exec $INSTDIR\Mods\${MOD_LOC}\Uninstall.exe

done:

FunctionEnd

;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_HEADERIMAGE

ShowInstDetails show
ShowUninstDetails show

;--------------------------------
;Pages
Edit: I found this but I don't understand it clearly. My knowledge of code is all self taught, so I am not very proficient here:

Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
kichik#
Don't give the user the option to skip the uninstaller by running it silently. Simply pass it /S on the command line.