HelluvaEngineer
18th December 2002 14:21 UTC
Call Function only if two sections selected
What's the most efficient way to call a function only if two sections have been selected by the user, using SectionGetFlags? Sorry if this is a dumb question, I just figured there was some way to do it quickly with an IntOp & operation.
HelluvaEngineer
18th December 2002 14:53 UTC
Ooops, actually meant if one OR the other is selected. What I am trying to do is check the selections from the user. They can install documentation only if one or another part of an SDK was selected. Will this work?:
SectionGetFlags${SDKDOC} $R1
IntOp $R2 $R1& 0x80000000
IntCmp $R2 0 Skip
SectionGetFlags${CPPSDK} $R1
SectionGetFlags${COMSDK} $R2
IntOp $R3 $R1| $R2
IntCmp $R3 0x80000000 Skip
Call InstallSDKDocStartShortcuts
Skip:
kichik
18th December 2002 15:09 UTC
This should do it:
SectionGetFlags${SDK_PART1} $0
SectionGetFlags${SDK_PART2} $1
IntOp$0 $1 | $0
># SECTION_SELECTED should be defined according to the NSIS version
>IntOp $0 $0 & ${SECTION_SELECTED}
>StrCmp $0 ${SECTION_SELECTED} 0 nonSelected
# do whatever you want to do if one or the other is selected
Goto done
nonSelected:
# do whatever you want to do if non is selected
>done:
HelluvaEngineer
18th December 2002 15:09 UTC
Also tried
SectionGetFlags ${CPPSDK} $R1
SectionGetFlags${COMSDK} $R2
IntOp $R3 $R1| $R2
IntOp $R4 $R3& 0x80000000
IntCmp $R4 0 Skip
>
Still no luck. It always installs if it enters this segment.
kichik
18th December 2002 15:22 UTC
From where are you trying to call this code? I would suggest you call it from .onSelChange, and uncheck the docs section if non of the two SDK sections are selected.
HelluvaEngineer
18th December 2002 15:29 UTC
OK, the last bit of code works. Another section was calling that function.
HelluvaEngineer
18th December 2002 16:05 UTC
Absolutely correct. I decided to pull this function. In the future, I will readdress it by using OnSelectChange, so that the user is aware of what's going on.
As a side note, I didn't realize that StrCmp worked for these comparisons. I was only using IntCmp. I will keep that in mind for the future.
Thanks!