Understanding the basic grammar of NSIs entry

Source: Internet
Author: User
Tags comments goto relative

Comments

Single-line comments with the well number "#" or semicolon ";", you can use the annotation syntax in C + + for cross row annotations.

Data type

Digital

Numeric constants can be expressed in decimal, hexadecimal (0x-prefix), octal (0-prefix), color in HTML-like medium RGB notation, but go to well number "#".

String

String constants can be quoted in quotation marks, and the conversion characters are prefixed with "$". The NSI syntax for the dollar sign, commonly used character wrapping, carriage return, tab, respectively, is: $$, $n, $r, $t

Line continuation character

The NSI script uses a backslash "" at the end of the line to indicate that the next line and the current line are logically the same line

Default header File

If there is a Nsisconf.nsh file in the Makensis directory, the file is automatically included unless the/NOCONFIG option is specified at compile time

Label

NSI uses goto statements and iferrors, MessageBox, iffileexists, and strcmp to control flow representations, and the label is the target statement of these statements. The syntax of the label definition:

A label must be defined in a function or section, and its scope is limited to the section or function that defines it. With the point number "." The marking of the beginning is the global label.

Relative jump

NSI scripts often use relative jumps to represent conditional branching, with a syntax of [+-][1-9], a plus sign that jumps forward from the current position, and a minus sign that jumps back from the current position. Number represents the number of statement bars for a jump. Example:

Goto +4

MessageBox MB_OK "The following message would be skipped"

Goto +3

MessageBox MB_OK "You'll never ever to this message box"

Goto-3

MessageBox MB_OK "Done"

Page

The wizard page is the most important interface element in the NSIs installer, and you can use the NSIs built-in page or custom interface in the NSI script to specify the order, display, and behavior of the page. The page directive is used to define the pages in the installer, Uninstpage is used to define, and the Pageex instruction provides the class as a feature, but offers more options. The order of the pages is consistent with the order in which they appear in the NSI script.

Page Options

Different pages have different options:

License page has licensetext,licensedata,licenseforceselection;

Components Selection page has componenttext;

Directory Selection page has Dirtext,dirvar (can only be used in Pageex), dirverify;

Un/installation log page has detailsbuttontext,completedtext;

Uninstall Confirmation page has Dirvar (only used in Pageex), Uninstalltext

For the built-in page,nsis supports three callback functions for custom interface and validation, two callback functions are supported for custom page NSIs.

Page instruction Syntax

Page license|components|directory|instfiles|uninstconfirm) [pre_function] [show_function] [leave_function]

Or:

Page Custom [Creator_function] [leave_function] [caption]

Uninstpage instruction Syntax

Uninstpage Custom [Creator_function] [leave_function] [caption]

OR

Uninstpage (license|components|directory|instfiles|uninstconfirm) [pre_function] [show_function] [leave_function]

Pageex syntax

Common NSI directives

NSI can be roughly divided into basic instructions, registry and INI operation instructions, general instructions, Process Control instructions, file operation instructions, uninstall instructions, string processing instructions, multi-language support instructions, restart instructions.

The following are common basic instructions:

Delete

Delete [/rebootok] File

Exec

Exec command

Execshell

Execshell action command [parameters] [Sw_shownormal | sw_showmaximized | sw_showminimized | Sw_hide]execshell "Open" Example "http://XIAZAIBA.COM/"

Execwait

execwait command [User_var (exit Code)]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.