rixor
14th March 2008 23:55 UTC
Section Question
I have multiple installer sections (components) and I have one that I want to be hidden, but only installed when one of the visible sections is installed.
How can I do that? I tried just grouping them, but the hidden section still installs regardless of which visible sections I have selected.
Anders
15th March 2008 00:02 UTC
check at runtime inside the section you might want to skip using code from sections.nsh
Section
${If} ${SectionSomethingHERE}
all of the section code
${EndIf}
SectionEnd
rixor
15th March 2008 00:07 UTC
Originally posted by Anders
check at runtime inside the section you might want to skip using code from sections.nsh
Section
${If} ${SectionSomethingHERE}
all of the section code
${EndIf}
SectionEnd
I wasn't using sections.nsh.
What would I put for ${SectionSomethingHERE}? Obviously the condition that the visible section was selected, but how do I articulate that?
Red Wine
15th March 2008 00:35 UTC
OutFile "test.exe"
ShowInstDetails show
Page components
page instfiles
!include "Sections.nsh"
!include "logiclib.nsh"
Section "" sec1
DetailPrint "Installing hidden section (sec1)"
SectionEnd
Section "when unselected hidden section unselected too" sec2
DetailPrint "Installing when unselected hidden section unselected too (sec2)"
SectionEnd
Section /o "another section" sec3
DetailPrint "Installing another section (sec3)"
SectionEnd
Function .onSelChange
SectionGetFlags ${sec2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
${IfThen} $R0 != ${SF_SELECTED} ${|} !insertmacro UnSelectSection ${sec1} ${|}
${IfThen} $R0 = ${SF_SELECTED} ${|} !insertmacro SelectSection ${sec1} ${|}
FunctionEnd
Anders
15th March 2008 01:26 UTC
with the logiclib, you can do ${If} ${SectionIsSelected} foo, but the code Red Wine will do fine aswell and will even work when the hidden section is executed first
I was thinking along the lines of
Section Hello HELLO
SectionEnd
Section
${If} ${SectionIsSelected} ${HELLO}
#code here
${Endif}
SectionEnd
rixor
15th March 2008 01:51 UTC
Well thanks to both of you! I ended up using red wines code. Though it took me a while to figure out that the function needs to come after the sections! Serves me right for not reading the log while it compiled.