Skip to content
⌘ NSIS Forum Archive

Conditions in sections for silent install

5 posts

GoldkinG#

Conditions in sections for silent install

Hi,

In my installer i wan to implement the Conditions in sections for silent installation.
Pls refer the below code.

Section 1
${If} {$Condition}==A
SectionIn RO
${EndIf}
---------------
------------
SectionEnd

In the above code, If i choose Condition B, the section is in selection state in the components page. pls anyone help me..

Thanks in advance...http://forums.winamp.com/images/smilies/smile.gif
Afrow UK#
SectionIn is a compile time instruction. To set at run time, use the SetSectionInInstType to set install types. To make the section read only at run time, use SetSectionFlag with ${SF_RO}. These are all in Sections.nsh.

Edit: SectionIn RO does not unselect the section, it makes it read only. To unselect/select sections at run time use the SelectSection/UnselectSection macros in Sections.nsh.
Edit: And of course you must use the macros before the Sections are executed (so in .onInit for example).

Stu
GoldkinG#
Actually i wan to set the read only mode in sections at compile time only. This can done based on the conditions or parameters are passed by text file. In text file i change the variable name means the sections "Read only" mode will be change.
demiller9#
To set the section flags at compile time, you must you compile time conditionals (!if, !ifdef, !ifndef, etc). You cannot use runtime conditionals (${If}, ${Else}, etc.) at compile time.