Archive: Syntax clarification re Section and SectionGetFlags


Syntax clarification re Section and SectionGetFlags
Syntax example for anyone trying to control actions based on component selection:

This example does not use MUI.

Given a section declared like this:

Section "ISAPI (win32) interface" IDX201
...
SectionEnd

Use syntax like this to get the section flags:

SectionGetFlags ${IDX201} $2

Display all your flags like this:

IntFmt $5 "%08X" $2
MessageBox MB_OK|MB_ICONINFORMATION "section flags $5"

Use code like this to test whether section is selected:

IntOp $2 $2 & 0x0001
IntCmp $2 0x0001 Finish

Thanks NSIS for a fantastic installer.


Using the Sections.nsh macros is way easier :)


Part of the reason I posted the example is because I couldn't find any place that showed both the section definition and the SectionGetFlags in the same place, and I kept misunderstanding the exact syntax of the section index - how it was automatically defined.

Once the syntax is understood, other usages of it start to make sense.