Archive: SectionGetFlags unexpected behaviour...


SectionGetFlags unexpected behaviour...
Hello guys,
It's a few days I am using nsis, but I manage to build a nice installer.

I have just one strange behaveiour using SectionGetFlags.

Below there is a snip of my nsi file (see the attach for the whole file).

I have four pages:
- the second one is the components one, which shows two sections. The user can select/deselect as he/she likes.

- the 3rd page is a custom page which recall CustomPageA function where I query section flags using SectionGetFlags.

Well, it gives the rigth result only if I query the first section !!!

It means it does not matter if I write
SectionGetFlags SecDocuBench $1
or
SectionGetFlags SecZeon $1

it always gives me the flag status of SecZeon (the first one)

I am getting crazy with it !

could some kindly have a look to my file and help me in finding my mistake ?

Many thanks,
MassimoM

;--------------------------------
;Pages

!insertmacro MUI_PAGE_WELCOME

!insertmacro MUI_PAGE_COMPONENTS

Page custom CustomPageA

!insertmacro MUI_PAGE_INSTFILES



;--------------------------------
;Installer Sections

Section "Zeon" SecZeon

;Some staff here
SectionEnd


Section "DocuBench" SecDocuBench

;Some staff here
SectionEnd


;--------------------------------
;Installer Functions

Function CustomPageA

SectionGetFlags SecDocuBench $1
MessageBox MB_OK $1

strcmp $1 "1" +2 0
return


You forgot the curly brackets. It should be SectionGetFlags ${SecDocuBench}. SecDocuBench is the name of a define which is defined when in the `
Section "DocuBench" SecDocuBench` line.

When converting the parameter to an integer which is the index of the section the text string "SecDocuBench" is processed as zero because it has no valid numbers in it. However, ${SecDocuBench} is processed as the value of the define named SecDocuBench. This value is the right index, not just zero.


SectionGetFlags unexpected behaviour
Many thanks for your reply and the explanation you gave (it was probably a trivial question for the ng reader...).

your suggestion works fine :-))

MassimoM