Search code examples
nsis

how I can do a section in other section?


I want to make a section in other section, how I can do this thing ?

Section  /o "Control System Toolbox"

     Section   "Communications Toolbox"
     SectionIn RO
FileWrite $9 "product=Control System Toolbox$\r$\n"
    AddSize 0
SectionEnd
FileWrite $9 "product=Control System Toolbox$\r$\n"
    AddSize 0
SectionEnd

Solution

  • You can organize sections in section groups. The groups cannot execute code but you can put hidden sections in them:

    Page Components
    Page InstFiles
    
    SectionGroup /e "Main Component"
    
    Section "" SID_MAIN
    DetailPrint "Installing Main Component..."
    SectionEnd
    
    Section /o "Bonus feature" SID_BONUS
    DetailPrint "Installing bonus Component..."
    SectionEnd
    
    SectionGroupEnd
    
    !include Sections.nsh
    !include LogicLib.nsh
    Function .OnSelChange
    ${If} ${SectionIsSelected} ${SID_BONUS}
        !insertmacro SelectSection ${SID_MAIN} ; The main component is required when installing the bonus component
    ${EndIf}
    FunctionEnd