Skip to content
⌘ NSIS Forum Archive

Run uninstaller before installation

2 posts

saurabhAggarwal#

Run uninstaller before installation

Hi

In my installation in .oninit function I use to first check whether application is already installed or not. If it is installed then a messagebox is displayed that the so and so app is already installed do you want to reinstall it. The message box has yes and no button. Now what I want is if user hits "yes" then the uninstaller first run uninstaller so as to uninstall previouly installed files and then proceed with normal installation.

Any help

Thanks
glory_man#
Maybe makensis.nsi in Example-folder helps you. There is function PageLeaveReinstall on it. You can use some of this code.
For example when user click "Yes" (on messagebox IDYES "label")

label:
HideWindow ;hide installer window

ClearErrors
ExecWait '...' ;run uninstaller
IfErrors ...

Delete '...' ;delete uninstaller ad other action

Quit
BringToFront