первое вроде как реализовал, вернее нашёл пример на nsis. За второе ОГРОМНОЕ спасибо. Может кому пригодиться:
Код:
Section "Section 2" Sec2
SectionEnd
SectionGroup "s1" Sec3
Section "Section 3"
ExecWait "cmd"
SectionEnd
SectionGroupEnd
SectionGroup "s2" Sec4
Section "Section 4"
SectionEnd
SectionGroupEnd
Function .onInit
# This is necessary otherwise Sec3 won't be selectable for the first time you click it.
SectionGetFlags ${Sec2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCpy $IndependentSectionState $R0
FunctionEnd
Function .onSelChange
Push $R0
Push $R1
# Check if Sec2 was just selected then select Sec3 and Sec4.
SectionGetFlags ${Sec2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 $IndependentSectionState +3
StrCpy $IndependentSectionState $R0
Goto UnselectDependentSections
StrCpy $IndependentSectionState $R0
Goto CheckDependentSections
# Select Sec2 if Sec3 or Sec4 was selected.
SelectIndependentSection:
SectionGetFlags ${Sec2} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} +3
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${Sec2} $R0
StrCpy $IndependentSectionState ${SF_SELECTED}
Goto End
# Were Sec3 or Sec4 just unselected?
CheckDependentSections:
SectionGetFlags ${Sec3} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} SelectIndependentSection
SectionGetFlags ${Sec4} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} SelectIndependentSection
Goto End
# Unselect Sec3 and Sec4 if Sec2 was unselected.
UnselectDependentSections:
SectionGetFlags ${Sec3} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${Sec3} $R0
SectionGetFlags ${Sec4} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${Sec4} $R0
End:
Pop $R1
Pop $R0
FunctionEnd