Skip to content
⌘ NSIS Forum Archive

SectionGetFlags

4 posts

o_owd#

SectionGetFlags

hello,

i have the following structure in my installer :
SectionGroup /e "!AA"
Section "01" Sec01
Section "02" Sec02
Section "03" Sec03
SectionGroupEnd
SectionGroup /e "!BB"
Section "04" Sec04
Section "05" Sec05
Section "05" Sec06
SectionGroupEnd
SectionGroup /e "!CC"
Section "07" Sec07
SectionGroupEnd
SectionGroup /e "!DD"
Section "08" Sec08
SectionGroupEnd
Section "!09" Sec09 
then, i use this :
    SectionGetFlags ${Sec01} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec02} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec03} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec04} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec05} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec06} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec07} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec08} $0
    WriteRegStr HKLM "reg_path" "key" "$0"
SectionGetFlags ${Sec09} $0
    WriteRegStr HKLM "reg_path" "key" "$0" 
if sections 1-8 are selected $0 is "1"
if sections 1-8 are not selected $0 is "0"

if section 9 is selected $0 is "9"
if section 9 is not selected $0 is "8"

why section 9 does not return "0" or "1" ? what am i doing wrong ?

thanks,
OJi.
Afrow UK#
Section flags store more than just 0 or 1 (selected or unselected).
Before writing the value to the registry, you need to do the following with it:

IntOp $0 $0 & ${SF_SELECTED}
$0 will not be 1 or 0.

You also need !include Sections.nsh in your script.

-Stu
o_owd#
i know that section flags store more than 0 or 1. i checked sections.nsh.
but why it does not work only for the last section ? i am trying to understand why, not just modify my script.
and what does your line do ? i checked the user manual but its chinese to me 🙂.

thanks,
OJi.