nsisnsis-mui

NSIS Multiple components option


I am a newbie in NSIS. I need some help regarding the MUI Components page. I am adding 3 section Group and different sections inside the Section Groups. I need to do different actions based on the user selection. Users have the options to select multiple options. So can anyone please help me with a sample code which is having more than 3 sections and verifying the user selection of those options and based on that displaying different message boxes


Solution

  • It is very unclear to me what your real goal is but checking section states can be done like this:

    !include LogicLib.nsh
    
    page components
    page instfiles
    
    SectionGroup /e "Group 1"
    Section "G1S1" SEC_G1S1
    SectionEnd
    Section /o "G1S2" SEC_G1S2
    SectionEnd
    SectionGroupEnd
    
    SectionGroup /e "Group 2"
    Section /o "G2S1" SEC_G2S1
    SectionEnd
    Section "G2S2" SEC_G2S2
    SectionEnd
    SectionGroupEnd
    
    Section -Hidden
    ${If} ${SectionIsSelected} ${SEC_G1S1}
        MessageBox mb_ok "G1S1 is selected"
    ${EndIf}
    ${If} ${SectionIsSelected} ${SEC_G1S2}
        MessageBox mb_ok "G1S2 is selected"
    ${EndIf}
    # Check the other sections here ...
    SectionEnd