<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Simple_script%3Asection_with_option</id>
	<title>Simple script:section with option - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Simple_script%3Asection_with_option"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Simple_script:section_with_option&amp;action=history"/>
	<updated>2026-06-06T20:48:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Simple_script:section_with_option&amp;diff=14530&amp;oldid=prev</id>
		<title>Gurzixo: A minimal script with a section having an option</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Simple_script:section_with_option&amp;diff=14530&amp;oldid=prev"/>
		<updated>2008-01-17T17:53:51Z</updated>

		<summary type="html">&lt;p&gt;A minimal script with a section having an option&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;â† Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:53, 17 January 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot;&gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;quot;execwait myprog.exe -myoption&amp;quot; or &amp;quot;execwait myprog&amp;quot; depending if the option is checked or not.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;quot;execwait myprog.exe -myoption&amp;quot; or &amp;quot;execwait myprog&amp;quot; depending if the option is checked or not.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I tried using sections inside sections (does not work), then SectionGroups. But I was not able to to get a consistent checking logic. Many thanks to &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot;&lt;/del&gt;Red Wine&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot; &lt;/del&gt;for giving me the solution (cf [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=285136 this] post.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I tried using sections inside sections (does not work), then SectionGroups. But I was not able to to get a consistent checking logic. Many thanks to &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[http://nsis.sourceforge.net/User:Red_Wine &lt;/ins&gt;Red Wine&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/ins&gt;for giving me the solution (cf [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=285136 this] post&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As this seems a fairly common need, here is the complete working script:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As this seems a fairly common need, here is the complete working script:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l55&quot;&gt;Line 55:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/highlight-nsis&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/highlight-nsis&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Credits ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Credits ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is not all my code. Most of comes from &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot;&lt;/del&gt;Red Wine&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is not all my code. Most of comes from &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[http://nsis.sourceforge.net/User:Red_Wine &lt;/ins&gt;Red Wine&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;].&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Code Examples]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Code Examples]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Gurzixo</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Simple_script:section_with_option&amp;diff=14529&amp;oldid=prev</id>
		<title>Gurzixo at 17:48, 17 January 2008</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Simple_script:section_with_option&amp;diff=14529&amp;oldid=prev"/>
		<updated>2008-01-17T17:48:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{PageAuthor|gurzixo}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
My install script needed an user-selectable section, with an user-selectable option. By default, this option is checked or not depending on the value of a registry key. Obviously, if the section is not selected, the option should be grayed out. The action of this section (if selected) is something like:&lt;br /&gt;
&amp;quot;execwait myprog.exe -myoption&amp;quot; or &amp;quot;execwait myprog&amp;quot; depending if the option is checked or not.&lt;br /&gt;
&lt;br /&gt;
I tried using sections inside sections (does not work), then SectionGroups. But I was not able to to get a consistent checking logic. Many thanks to &amp;quot;Red Wine&amp;quot; for giving me the solution (cf [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=285136 this] post.&lt;br /&gt;
&lt;br /&gt;
As this seems a fairly common need, here is the complete working script:&lt;br /&gt;
== The Script ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!Include &amp;quot;MUI.nsh&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Sections.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;logiclib.nsh&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!insertmacro MUI_PAGE_COMPONENTS&lt;br /&gt;
!insertmacro MUI_PAGE_INSTFILES&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Name &amp;quot;Section with options&amp;quot;&lt;br /&gt;
OutFile &amp;quot;test.exe&amp;quot;&lt;br /&gt;
ComponentText &amp;quot;Select the components you want to install.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var /GLOBAL WithOption&lt;br /&gt;
&lt;br /&gt;
SectionGroup /e &amp;quot;MyProg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Section &amp;quot;&amp;quot; sec1&lt;br /&gt;
    ${If} $WithOption == ${SF_SELECTED}&lt;br /&gt;
	MessageBox MB_OK &amp;quot;MyProg -MyOption&amp;quot;&lt;br /&gt;
    ${Else}&lt;br /&gt;
	MessageBox MB_OK &amp;quot;MyProg&amp;quot;&lt;br /&gt;
    ${endif}&lt;br /&gt;
SectionEnd&lt;br /&gt;
&lt;br /&gt;
Section /o &amp;quot;MyOption&amp;quot; sec2&lt;br /&gt;
#&lt;br /&gt;
SectionEnd&lt;br /&gt;
&lt;br /&gt;
SectionGroupEnd&lt;br /&gt;
&lt;br /&gt;
Function .onSelChange&lt;br /&gt;
SectionGetFlags ${sec1} $R0&lt;br /&gt;
IntOp $R0 $R0 &amp;amp; ${SF_SELECTED}&lt;br /&gt;
&lt;br /&gt;
${If} $R0 == ${SF_SELECTED}&lt;br /&gt;
    !insertmacro ClearSectionFlag ${sec2} ${SF_RO}&lt;br /&gt;
${ElseIf} $R0 != ${SF_SELECTED}&lt;br /&gt;
    !insertmacro UnSelectSection ${sec2}&lt;br /&gt;
    !insertmacro SetSectionFlag ${sec2} ${SF_RO}&lt;br /&gt;
${EndIf}&lt;br /&gt;
SectionGetFlags ${Sec2} $WithOption&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
== Credits ==&lt;br /&gt;
This is not all my code. Most of comes from &amp;quot;Red Wine&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
[[Category:Code Examples]]&lt;/div&gt;</summary>
		<author><name>Gurzixo</name></author>
	</entry>
</feed>