Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   SectionIsSelected, unknown variable (http://forums.winamp.com/showthread.php?t=372747)

Smurge 8th October 2013 12:07

SectionIsSelected, unknown variable
 
Hello

I try to use the "SectionIsSelected" macro from the logiclib.nsh, but it seems not to work with Sections that appear below the IF function.

In my example the MessageBox "g1o2_unselected" never appear. The compiler returns the warning:
unknown variable/constant "{g1o2}" detected, ignoring (macro:_SectionFlagIsSet:2)

So it appears that this IF only work when it is bellow the dependent section.
Is this a limitation of the SectionIsSelected macro? Is there a workaround?

Any help is appreciated

HTML Code:

!include "Sections.nsh"
!include "logiclib.nsh"

;--------------------------------
Name "Section Selected"
OutFile "section_selected.exe"
RequestExecutionLevel user
;--------------------------------
; Pages
Page components
Page instfiles
;--------------------------------
; Sections

Section !Required
  SectionIn RO
SectionEnd

Section "Group 1 - Option 1" g1o1
       
${If} ${SectionIsSelected} ${g1o2}
MessageBox MB_OK g1o2_selected
${Else}
MessageBox MB_OK g1o2_unselected
${EndIf}

SectionEnd


Section /o "Group 1 - Option 2" g1o2
       
${If} ${SectionIsSelected} ${g1o1}
MessageBox MB_OK g1o1_selected
${Else}
MessageBox MB_OK g1o1_unselected
${EndIf}

SectionEnd


Afrow UK 8th October 2013 15:02

Where you have ${g1o2}, g1o2 has not yet been defined. You will either have to define it yourself before or just substitute it with the value it would end up having (the section index or 1 in this case).

Stu

Smurge 9th October 2013 10:11

I tried something similar, but this doesn't work also.
When i set the define above the sections
Quote:

!define g1o2 1
the compiler exits with:

Quote:

Section: "Group 1 - Option 2" ->(g1o2)
Error: "g1o2" already defined, can't assign section index!
Error in script "stdin" on line 33 -- aborting creation process
when i put the define below the sections
Quote:

!define: "g1o2" already defined!
Error in script "stdin" on line 39 -- aborting creation process

Afrow UK 9th October 2013 15:45

If you're going to define it yourself, you have to remove the token from the Section line.

Stu


All times are GMT. The time now is 17:40.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.