Skip to content
⌘ NSIS Forum Archive

Uninstall check

12 posts

DVDK#

Uninstall check

I have made a modern installer, and now have a question about the uninstall section.

Lets say that my installer includes 3 different sections. The user only installs one of the 3 sections, because he has the needed files that are located in the other 2 sections.

When the user wants to uninstall, then all sections are being uninstalled, but I only want the section he installed with my installer to be uninstalled. How do I do that?
Joost Verburg#
Use InstallOptions to create a custom page.

A components page for the uninstaller is on the TODO list.
kichik#
Or save in the registry, an INI file or in a regular file what sections have been selected. To do so just write a certain value at the end of each section and read it in the uninstaller.
Joel#
I'll have the same thing, but
When I called the uninstaller, it
delete all the files... installed and NOT installed
and it doesn't return in error ...
so maybe you want like the old fashion way...
Delete all the files ... installed and not installed

Just my opinion 😁
DVDK#
Uninstall check

Yup, also having big trouble still, but also very hard to understand when english is second languges fro me.

But I have maneced to solve the problem meanwhile with som CMD files which are being executed upon uninstall instead. In that way I can control it, but far from optimal.

Its very easy to understand when you read faqs, but the problem sneaks in when all those foreign words comes along. 🧟
kichik#
I am sorry but I don't understand how CMD files help you in uninstalling more then one component... What exactly are you trying to do?
DVDK#
CMD

Its because I have made some CMD files for each component, which are being executed after each other upon uninstall.

I want the uninstall section to uninstall the things that where installed by my installer. Lets say that my installer includes:

something.txt
something.exe
someotherthing.exe

Lets say that the user already has someotherthing.exe. He will offcause not install this component again since there is no reason to. But when he execute the uninstaller, will the someotherthing.exe also be uninstalled and I do not want this, since it was not included in the installation.

So the thing I want is that my uninstall section only will uninstall the things the user has included. But I dont know how to make this custom page, since the words are very hard to understand. 🧟 Do someone have an example of this, since this will make it easier for me to understand.
kichik#
You don't need a custom page for this. All you need to do is remember what the user have installed. You can do this by writing the installed sections into an INI file, the registry or a regular file. Lets take the INI file for example. In the installer you'll have:

Section 1
  #install section 1 stuff
  WriteIniStr $INSTDIR\uninstall.ini comps section1 yes
SectionEnd
Section 2
  #install section 2 stuff
  WriteIniStr $INSTDIR\uninstall.ini comps section2 yes
SectionEnd 
In the uninstaller:

Section uninstall
  ReadIniStr $0 $INSTDIR\uninstall.ini comps section1
  StrCmp $0 "yes" 0 dontUninstallSection1
    # uninstall section1
  dontUninstallSection1:
  ReadIniStr $0 $INSTDIR\uninstall.ini comps section2
  StrCmp $0 "yes" 0 dontUninstallSection2
    # uninstall section2
  dontUninstallSection2:
SectionEnd 
kukymann#
Hi, my question is little different.
A user installed section1, section2 and section3. But, what if he wants uninstall only section1 and section3. I thought about Custom page in Uninstall procces, where he selects what section he wants uninstall. It's possible? Or i must wait for A components page?
pengyou#
kukymann, the NSIS Archive has something that seems to do what you want:

"This example demonstrates how to implement Add/Remove functionality in the installer. It operates similar to MS Office installer for example. Unlike conventional NSIS installer it does not only install (upgrade) selected components but also removes unselected components."



An example is included so you can see how the idea works.