
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4786 212acab6-be3b-0410-9dea-997c60f758d6
106 lines
3.9 KiB
Text
106 lines
3.9 KiB
Text
\H{sections} Sections
|
|
|
|
Each NSIS installer contains one or more sections. Each of these sections are created, modified, and ended with the following commands.
|
|
|
|
\b Each section contains zero or more instructions.
|
|
|
|
\b Sections are executed in order by the resulting installer, and if ComponentText is set, the user will have the option of disabling/enabling each visible section.
|
|
|
|
\b If a section's name is 'Uninstall' or is prefixed with 'un.', it's an uninstaller section.
|
|
|
|
\S1{ssectioncommands} Section Commands
|
|
|
|
\S2{saddsize} AddSize
|
|
|
|
\c size_kb
|
|
|
|
Tells the installer that the current section needs an additional "size_kb" kilobytes of disk space. Only valid within a section (will have no effect outside of a section or in a function).
|
|
|
|
\c Section
|
|
\c AddSize 500
|
|
\c SectionEnd
|
|
|
|
\S2{ssection} Section
|
|
|
|
\c [/o] [([!]|[-])section_name] [section_index_output]
|
|
|
|
Begins and opens a new section. If section_name is empty, omitted, or begins with a -, then it is a hidden section and the user will not have the option of disabling it. If the section name is 'Uninstall' or is prefixed with 'un.', then it is a an uninstaller section. If \e{section_index_output} is specified, the parameter will be \R{define}{!defined} with the section index (that can be used for \R{sectionsettext}{SectionSetText} etc). If the section name begins with a !, the section will be displayed as bold. If the /o switch is specified, the section will be unselected by default.
|
|
|
|
\c Section "-hidden section"
|
|
\c SectionEnd
|
|
\c
|
|
\c Section # hidden section
|
|
\c SectionEnd
|
|
\c
|
|
\c Section "!bold section"
|
|
\c SectionEnd
|
|
\c
|
|
\c Section /o "optional"
|
|
\c SectionEnd
|
|
\c
|
|
\c Section "install something" SEC_IDX
|
|
\c SectionEnd
|
|
|
|
To access the section index, curly brackets must be used and the code must be located below the section in the script.
|
|
|
|
\c Section test1 sec1_id
|
|
\c SectionEnd
|
|
\c
|
|
\c Section test2 sec2_id
|
|
\c SectionEnd
|
|
\c
|
|
\c Function .onInit
|
|
\c SectionGetText ${sec2_id} $0
|
|
\c MessageBox MB_OK "name of ${sec2_id}:$\n$0" # will correctly display 'name of 1: test2'
|
|
\c FunctionEnd
|
|
|
|
\c Function .onInit
|
|
\c SectionGetText ${sec2_id} $0
|
|
\c MessageBox MB_OK "name of ${sec2_id}:$\n$0" # will incorrectly display 'name of ${sec2_id}: test1'
|
|
\c # plus a warning stating:
|
|
\c # unknown variable/constant "{sec2_id}" detected, ignoring
|
|
\c FunctionEnd
|
|
\c
|
|
\c Section test1 sec1_id
|
|
\c SectionEnd
|
|
\c
|
|
\c Section test2 sec2_id
|
|
\c SectionEnd
|
|
|
|
\S2{ssectionend} SectionEnd
|
|
|
|
This command closes the current open section.
|
|
|
|
\S2{ssectionin} SectionIn
|
|
|
|
\c insttype_index [insttype_index] [RO]
|
|
|
|
This command specifies which install types (see \R{ainsttype}{InstType}) the current section defaults to the enabled state in. Multiple SectionIn commands can be specified (they are combined). If you specify RO as a parameter, then the section will be read-only, meaning the user won't be able to change its state. The first install type defined using \R{ainsttype}{InstType} is indexed 1, the next 2 and so on.
|
|
|
|
\c InstType "full"
|
|
\c InstType "minimal"
|
|
\c
|
|
\c Section "a section"
|
|
\c SectionIn 1 2
|
|
\c SectionEnd
|
|
\c
|
|
\c Section "another section"
|
|
\c SectionIn 1
|
|
\c SectionEnd
|
|
|
|
\S2{ssectiongroup} SectionGroup
|
|
|
|
\c [/e] section_group_name [index_output]
|
|
|
|
This command inserts a section group. The section group must be closed with \R{ssectiongroupend}{SectionGroupEnd}, and should contain 1 or more sections. If the section group name begins with a !, its name will be displayed with a bold font. If /e is present, the section group will be expanded by default. If \e{index_output} is specified, the parameter will be !defined with the section index (that can be used for \R{sectionsettext}{SectionSetText} etc). If the name is prefixed with 'un.' the section group is an uninstaller section group.
|
|
|
|
\c SectionGroup "some stuff"
|
|
\c Section "a section"
|
|
\c SectionEnd
|
|
\c Section "another section"
|
|
\c SectionEnd
|
|
\c SectionGroupEnd
|
|
|
|
\S2{ssectiongroupend} SectionGroupEnd
|
|
|
|
Closes a section group opened with \R{ssectiongroup}{SectionGroup}.
|