Archive: Skip a section without deselecting components checkbox


Skip a section without deselecting components checkbox
Hi,

I am trying to skip a section if another section has been selected. However, I do not want to uncheck the section's checkbox.

I tried creating a label for the section, and just adding an if statement within the other sections body. For instance,


Section "Interface" SecCNC_Interface
!insertmacro SectionFlagIsSet ${SecVision_System} ${SF_SELECTED} exit_section continue
continue:
...
...
...
exit_section:
SectionEnd

Section /o "Vision System" Sec2
...
...
...
SectionEnd



it compile, but it thoughs a warning saying

unknown variable/constant "{SecVision_System}" detected, ignoring (macro:SectionFlagIsSet:2)
Any idea what is happening? how can I implement the functionality I am looking to use?

Sorry I just realized that I did not post the code properly. my code uses the correct tag for SectionFlagIsSet; it uses Sec2


Sec2 is defined later on in the script i.e. it is not yet defined when the compiler is parsing your SectionFlagIsSet code.

If Sec2 has to be after, you will have to use its actual value instead which is the zero based section index.

Also you can use ${If} ${SectionIsSelected} instead of the SectionFlagIsSet macro (may look a bit tidier).

Stu


Afrow UK, I am really not sure what is the zero based section index. Can you further delve on how it works?


I am using the code below to index Sec2 label as 2, and it is not updating register $0. Any idea where is the problem?

Thanks


SectionGroup "GroupSection" GrpSec1
Section "Section1" Sec1
Push $0
SectionGetFlags 2 $0
messagebox MB_OK "SectionGetFlag $0"
${IfNot} ${SectionIsSelected} $0
...
${EndIf}
Pop $0
SectionEnd

Section "Section 2" Sec2
...
SectionEnd
SectionGroup

Remove the sectiongetflags command, and do ${If} ${SectionIsSelected} directly on the section ID.


Originally posted by jai123
Afrow UK, I am really not sure what is the zero based section index. Can you further delve on how it works?
The zero based section index is an integer value that identifies the section; 0 is the first section, 1 is the 2nd section and so on. With your code Sec2 will be defined by the compiler with a value of 1. Therefore just use 1 in your code instead of ${Sec2}:

${IfNot} ${SectionIsSelected} 1
...

Stu

Hey Afrow, I have followed your advice, and it still does not work. I have tried both using index 1 and 2 (assuming that the group section is also counted). Any ideas where it could be the problem?