Setup Section |
Top Previous Next |
Setup Section
A Setup section is used to setup global Variables that will be available to the rest of the script and Prerequisites that will be evaluated to ensure that it is appropriate for script processing to continue.
It is recommended that you declare variables and values that change frequently first, and consider declaring those in the Setup section even if they are specific to a particular section. That way you can simply make changes at the top of the script without having to go through the rest of it looking for entries risk messing up or missing an entry that could negatively affect the outcome.
Command Syntax
If you wish to create a Setup section, you simply type the word Setup into the script surrounded by square brackets:
[Setup] IMPORTANT: The Setup section should be the FIRST section in the script after any opening comments, so that any entries in the section are available to all the following sections. Example
This example demonstrates creating a setup section to manually generate re-usable variables that can be used throughout the script. Note the re-use of declared variables to build further variables once they have been created. Pipeline Runner will automatically process these at runtime:
[Setup] Var:Revision=123
; Now declare other global variables here Var:Publisher=<Company Name Here> Var:Major=1 Var:Minor=0 Var:Build=0 Var:Version=%%Major%%.%%Minor%%.%%Build%%.%%Revision%% Var:FileNameVersion=%%Major%%_%%Minor%%_%%Build%%_%%Revision%%
As a result of the values above the Version and FileNameVersion variables will have the values 1.0.0.123 and 1_0_0_123 respectively. Note: This example shows manual calculation of the value, but you can also use Special Functions to populate variables. In the case of a Version number you could use the GetFileVersion special function to retrieve the value automatically from a specified file. See Also: Variables Notification Section Catch Section Finally Section User Sections Tasks Section Code Section Special Functions GetFileVersion |