How can I make a section in NSIS unchecked by default
Asked Answered
R

2

12

I have a NSIS installer, here I have some components that user can choose to install:

Section "Modules" SecModules
  SetOutPath "$INSTDIR"
  CreateDirectory $INSTDIR\modules
  ...
SectionEnd

Section "Freenode util" SecFreenode
  SetOutPath "$INSTDIR"
  CreateDirectory $INSTDIR\modules
  ...
SectionEnd

how can I make the second one unchecked? By default they all are checked

Responsiveness answered 17/4, 2013 at 9:46 Comment(0)
R
18
; unselected because it is /o
Section /o "Modules" SecModules
  SetOutPath "$INSTDIR"
  CreateDirectory $INSTDIR\modules
  ...
SectionEnd

; selected
Section "Freenode util" SecFreenode
  SetOutPath "$INSTDIR"
  CreateDirectory $INSTDIR\modules
  ...
SectionEnd
Responsiveness answered 17/4, 2013 at 9:53 Comment(1)
Don't remember you should accept your own answer if you think it solves your problem :)Monarski
M
7

Apart from Section /o, you can also use SectionIn to control default sections. The latter might be useful if you have several sections and you plan to offer several installation types (see InstType). Lastly, you can control the state of a section based on logic, using SectionSetFlags.

Mroz answered 17/4, 2013 at 10:32 Comment(1)
I fail to understand how could I use that for my purpose. I want to have a list of optional components and some of them should be installed by default and some of them only if user check them. I don't understand what is SectionIn good for in that caseResponsiveness

© 2022 - 2024 — McMap. All rights reserved.