View Single Post
Old 4th March 2020, 22: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