Skip to content
⌘ NSIS Forum Archive

SectionIsSelected in section?

6 posts

safl#

SectionIsSelected in section?

Hello!

I'm trying to use SectionIsSelected from Sections.nsh, to write some config files when certain sections have been selected. I'm executing this code inside my first section:

${If} ${SectionIsSelected} ${SEC03}
WriteIniStr DIR GROUP KEY VALUE
WriteIniStr DIR GROUP KEY VALUE2
WriteIniStr DIR GROUP KEY VALUE3
${EndIf}

When i compile i get the warning:
"warning: unknown variable/constant "{SEC03}" detected, ignoring (macro:_SectionFlagIsSet:2)

How can i fix this? I've tried using the .selChange or what's it's name. but problem is that the config file i want to write to haven't been installed at this point.

Regards,
Simon
glory_man#
First you need to declare SEC03 constant. So use
Section "Name" SEC03
. After that use it.
safl#
Too bad. This means i can't do this when my section is declared before the section i wan't to check.
Guest#
You can use Section Index to set flag, If i'm wrong 2 indicate to this section, so

${If} ${SectionIsSelected} 2
WriteIniStr DIR GROUP KEY VALUE
WriteIniStr DIR GROUP KEY VALUE2
WriteIniStr DIR GROUP KEY VALUE3
${EndIf}

there is no need to Name Sections