Archive: Need your help - If only 1 Section is selected...


Need your help - If only 1 Section is selected...
Hi,
I need your help. I've make a code who checks if one of the section 1-3 is seleted. If one Section of them isn't selected it jumps to Skip: and install an other File.

No I need to add something. When only ONE section of this 3 is selected the code shouldn't jump to skip. Could you explain me how I can do this?

THANK YOU :)

Here is my Code:

;CMDS JOIN
SectionGetFlags ${Section1} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 Skip
SectionGetFlags ${Section2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 Skip
SectionGetFlags ${Section3} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 Skip

SetOutPath "$INSTDIR\Infos\"
File "File.ini"

${FileJoin} "$INSTDIR\config.ini" "$INSTDIR\Infos\File.ini" "$INSTDIR\config.ini"

Delete "$INSTDIR\Infos\File.ini"

Goto Finish

Skip:

SetOutPath "$INSTDIR\Infos\"
File "File2.ini"

${FileJoin} "$INSTDIR\config.ini" "$INSTDIR\Infos\File2.ini" "$INSTDIR\config.ini"

Delete "$INSTDIR\Infos\File2.ini"

Finish:
;CMDS JOIN END

You can calculate number of selected sections and compare result with 1:

Function .onSelChange

StrCpy $R1 0
SectionGetFlags ${Section1} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 +2
IntOp $R1 $R1 + 1
SectionGetFlags ${Section2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 +2
IntOp $R1 $R1 + 1
SectionGetFlags ${Section3} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 +2
IntOp $R1 $R1 + 1
IntCmp $R1 1 0 skip skip
; some code
skip:
MessageBox MB_OK "Selected $R1"

FunctionEnd