Old 4th March 2020, 21:58   #1
cgoma
Junior Member
 
Join Date: Mar 2020
Posts: 2
nsis script for selecting packages for uninstallation.

Hi,

I have created nsis script for installation of some packages on windows. This installer works fine. Currently this installer uninstall all packages and then install the packages which can be selected ( using the checkbox during installation).
I should get option given by below code during uninstallation (This is my instllation code)


code:
Name example
OutFile example.exe

UninstPage uninstConfirm


;WriteUninstaller "$INSTDIR\uninst.exe"

ComponentText "Please choose the packages which needs to install!!!" "Install Type" "Hope it works"

Section "UI" sec1
WriteUninstaller "$INSTDIR\uninst.exe"
MessageBox MB_ICONEXCLAMATION|MB_OK ${sec1}
SectionEnd

Section "OC" sec2
MessageBox MB_ICONEXCLAMATION|MB_OK ${sec2}
SectionEnd

Section "MAX" sec3
MessageBox MB_ICONEXCLAMATION|MB_OK ${sec3}
SectionEnd

Section "DATABASE" sec4
MessageBox MB_ICONEXCLAMATION|MB_OK ${sec4}
SectionEnd

# defines for newer versions
!include Sections.nsh
# SECTION_OFF is defined in Sections.nsh as 0xFFFFFFFE
!define SECTION_ON ${SF_SELECTED} # 0x1

# defines for 2.0b0 and below
#!define SECTION_ON 0x80000000
#!define SECTION_OFF 0x7FFFFFFF

Function .onInit
Push $0

StrCpy $1 ${sec1} ; Gotta remember which section we are at now...
SectionGetFlags ${sec1} $0
IntOp $0 $0 | ${SECTION_ON}
SectionSetFlags ${sec1} $0

SectionGetFlags ${sec2} $0
IntOp $0 $0 & ${SECTION_ON}
SectionSetFlags ${sec2} $0

SectionGetFlags ${sec3} $0
IntOp $0 $0 & ${SECTION_ON}
SectionSetFlags ${sec3} $0

SectionGetFlags ${sec4} $0
IntOp $0 $0 & ${SECTION_ON}
SectionSetFlags ${sec4} $0

Pop $0
FunctionEnd



But now I wanted to uninstall only selected packages (i.e. selected using checkbox)




Please let me know what I can do to achieve this.
cgoma is offline   Reply With Quote
Old 5th March 2020, 03:30   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,281
It is not clear to me what you are asking but state from the installer is not automatically restored in the uninstaller. You must save state in the registry or a .ini file.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th March 2020, 04:55   #3
cgoma
Junior Member
 
Join Date: Mar 2020
Posts: 2
Hi Anders,

Thank for your reply. The code I have pasted earlier was for my installer. But now I wanted to the installer first should ask for what you need to uninstall (e.g. suppose my installer is updating a service only, then it should uninstall old service first then it should install new service.)

Please check the screenshot attached. The page in screenshot should come first while running the installer.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	51
Size:	9.2 KB
ID:	54529  
cgoma is offline   Reply With Quote
Old 6th March 2020, 00:07   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,281
Does it make sense to present a list to the user? What happens if the user chooses not to uninstall something, do you just install the new version on top or do you not install the item?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
nsis

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump