Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Inno Setup 2: syntax parsing (1)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Background Overview

The    Inno Setup installer is created as a compiled script, which is actually an ASCII code text file similar to .INI file format (it is not as complex as you might think), which supports the Pascal language. Unicode Inno Setup supports UTF-8 encoded text files.

The    script has an extension of ".iss" (which represents the Inno Setup script). Scripts control all aspects of the installer. It specifies which files will be installed where, where shortcuts will be created, and why.

   script files can generally be edited using the editor built into the installer compiler program. After you have written the script, the next final step is to select "compile" in the program compiler. Once created, you can run the installer compiled according to your script. By default, this installer is created in a directory called output under the directory that contains the script files.

   if you want to see how it works, start the installer compiler, click File | Open, and select a script file in the Examples subdirectory under the Inno Setup installation directory. (you can also use these sample scripts as templates for writing your own scripts.)

Overview of script format

   Inno Setup has prepared some paragraphs. Each segment controls a different part of the installer. Each paragraph begins with the name of the paragraph contained in parentheses [], and there are some related entries in each paragraph.

   has two different types of segments: some are like the [Setup] section, with entries containing the instruction name and value (formatted as Directive=Value), and some like the [Files] section, where entries are separated by parameters. The following is an example:

[Setup] AppName=My Program [Files] Source: "MyProg.exe"; DestDir: "{app}"

Note that it is legal to specify multiple segments with the same name in the script.

Annotation

You can write comments by using the price semicolon at the beginning of the line (comments will be ignored at compile time). The following is an example:

This is a note.

The script supports the A C-like # include directive to include files in the script. As follows:

# include "filename.txt"

If the full path is not provided in the file name, the compilation will look in the same directory that contains the # include directive. In cases where the file name is prefixed with "compiler:", the file is found in the compiler directory.

Syntax parsing 1. Parameters in the segment

Sections in all    scripts, except for the [Setup], [Messages], [CustomMessages], and [LangOptions] paragraphs, can have multiple parameters in the included lines. The following is an example of the [Files] paragraph:

[Files] Source: "MyProg.exe"; DesDir: "{app}" Source: "MyProg.chm"; DestDir: "{app}" Source: "MyProg.txt"; DestDir: "{app}"; Flags: isreadme

Each parameter consists of a name, followed by a colon, followed by a value. Unless otherwise specified, if the parameter is not specified, it will be set to a default value. Multiple parameters in a line are separated by semicolons and can appear in any order.

If the value of the    parameter contains a user-defined string, it is generally enclosed in double quotes (""), such as the file name. The use of quotation marks is not necessary, but doing so may include spaces, semicolons and double quotes in the first or last bit of the value.

   embeds a reference value in one double quotation mark, which requires two consecutive double quotation marks. Examples are as follows:

"This"contains"embedded"quotes"

Installing the compiler treats it as:

This "contains" embeded "quotes

If you want the parameter value to be a single double quote character, use four double quote characters: ". The outer two characters are used to contain references, and the inner two characters are used to embed a single double quotation mark character.

two。 Constant

Constants can be embedded in most    project scripts, and these predefined characters are enclosed in parentheses {}. The installer or uninstaller translates these constants into text values based on user selection and system configuration. For example, {win} is translated as "C:\ WINDOWS" on most systems.

The    character "{" usually starts as a constant. If you want to use it as an actual character, you need to use two consecutive "{". (not required for "}")

   when a backslash is followed directly after a constant, the installer or uninstaller will automatically delete the backslash number if the value of the constant already contains a backslash number. Therefore, if a special constant value is "C:\", {constantname}\ file will be translated as "C:\ file" instead of "C:\ file". If you want to prevent accidents, put the backslash in the {} character, such as {app} {}.

   constants include directory constants, shell file constants, and other constants. Common constants are listed as follows:

{app}: the application directory selected by the user on the Select destination page in the installation wizard. For example, if you specify {app}\ MyProg.exe in the project, and the user selects "D:\ MyProg" as the application directory, the installer is actually installed in the "D:\ MyProg\ MyProg.exe" path. {src}: the directory where the installer file (that is, the installation package path) is located. For example, if {src}\ MyProg_Install.exe is used in the project, and the user chooses to install it in the "F:\" directory. Then, of course, the {src} value will not change, and the installer will change the {app} value to "F:\ MyProg.exe". {srcexe}: the completion path of the installer file, such as "D:\ FeiQ\ FeiQ.exe". {uninstallexe}: the full pathname of the download program extracted by the installer, such as "D:\ FeiQ\ uninstall000.exe". {log}: the name of the log file, which returns an empty character if logging is not enabled. 3. Installation script segment

The    installation script segment is used to parse the meaning and usage of each segment in the script. What will happen after that? let's hear it next time.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report