Introduction 'Initial Setup' Page 'Setup' Page 'Dir' Page 'Files' Page 'Icons' Page 'INI' Page 'Registry' Page 'Run' Page 'Delete' Page 'Spanning' Page 'Finish' Page 'Listing' Page 'Options' Page Reusing Scripts

ScriptMaker Tutorial

Appendix 1 - Constants



The majority of the Setup Script entries can have constants embedded in them. These are always enclosed in brace characters { }. When Setup is started, it will translate the constants to their literal values, depending on the user's choices and system configuration. For example, "{win}", as described below, would translate to "C:\WINDOWS" on most systems.

A "{" is treated as the start of the constant. If you want to use that actual character, you must use two consecutive "{" characters.

When a backslash immediately follows a constant, Inno Setup automatically removes the backslash if the constant ended in a backslash already. This way if a particular constant pointed to "C:\", "{constantname}\file" will correctly translate to "C:\file" and not "C:\\file". If you want to prevent this from happening, enclose the backslash in { } characters, e.g. "{app}{\}".

Directory Constants

{app}
The application directory, which the user selects on the Select Directory page of the wizard. For example: If you used "{app}\MYPROG.EXE" on an entry and the user selected "C:\MYPROG" as the application directory, Setup will translate it to use "C:\MYPROG\MYPROG.EXE".

{win}
The system's Windows directory. For example: If you used "{win}\MYPROG.INI" on an entry and the system's Windows directory is "C:\WINDOWS", Setup will translate it to use "C:\WINDOWS\MYPROG.INI".

{sys}
The system's Windows System directory (System32 in a 32-bit installation on Windows NT). For example: If you used "{sys}\CTL3DV2.DLL" on an entry and the system's Windows System directory is "C:\WINDOWS\SYSTEM", Setup will translate it to use "C:\WINDOWS\SYSTEM\CTL3DV2.DLL".

{src}
The directory in which the Setup files are located. For example: If you used "{src}\MYPROG.EXE" on an entry and the user is installing from "S:\", Setup will translate it to use "S:\MYPROG.EXE".

{sd}
System Drive. The drive Windows is installed on, typically "C:". On 32-bit installations on Windows NT, this directory constant is equivalent to the SystemDrive environment variable.

{pf}
(32-bit only) Program Files. The path of the system's Program Files directory, typically "C:\Program Files".

{cf}
(32-bit only) Common Files. The path of the system's Common Files directory, typically "C:\Program Files\Common Files".

{tmp}
Temporary directory. This is not the value of the user's TEMP environment variable. It is a subdirectory of the user's temporary directory which is created at installation startup (with a name like "C:\WINDOWS\TEMP\IS-xxxxx.tmp"). All files and subdirectories in this directory are deleted when the setup program exits. This is primarily useful for extracting files that are to be executed in the [Run] section but aren't needed after the installation.

{fonts}
Fonts directory. Windows 95/98/NT 4.0 have a dedicated directory for fonts (normally named FONTS under the Windows directory), and on 32-bit installations this constant points to that directory. On 16-bit installations and 32-bit installations running on Windows NT 3.51, this constant is equivalent to {sys}.

{dao}
(32-bit only) DAO directory. When the installation is run on Windows 95/NT 4+, this is equivalent to "{cf}\Microsoft Shared\DAO". When run on Windows NT 3.51, this is equivalent to "{win}\MSAPPS\DAO"".

Shell Folder Constants

Inno Setup supports another set of directory constants, which are called shell folder constants. They can be used in the same way as the other directory constants. However, on 16-bit installations only the {group} shell folder constant can be used, and only in the [Icons] section. On 32-bit installations, if support for NT 3.51 enabled by placing a "MinVersion=4,3.51" line in the script's [Setup] section this same restriction applies.

NOTE: The "user" constants below refer to the currently logged in user's profile. "common" constants refer to the All Users profile. Since currently only Windows NT directly supports an All Users profile, the "common" constants are equivalent to the "user" constants on Windows 95/98.

{group}
The path to the program group, as selected by the user on Setup's Select Program Group wizard page. On Windows NT, this folder is always created under the All Users profile unless the user installing the application does not have administrative privileges, in which case it is created on the user's profile.

{userdesktop}
The path to the current user's desktop. It's recommended that desktop shortcuts be placed here.

{commondesktop}
The path to the All Users profile desktop.

{userstartmenu}
The path to the top level of the current user's Start Menu.

{commonstartmenu}
The path to the top level of All Users profile Start Menu.

{userprograms}
The path to the current user's Programs folder on the Start Menu.

{commonprograms}
The path to the Programs folder on the All Users profile Start Menu.

{userstartup}
The path to the current user's Startup group.

{commonstartup}
The path to All Users profile Startup group. It's recommended that startup items be placed here.

{sendto}
The path to the current user's Send To folder. (There is no common Send To folder.)

{userappdata}
The path to the current user's Application Data folder. This constant is only supported by Windows 98, NT 4.0, and later.

{userdocs}
The path to the current user's My Documents folder (or on NT 4.0, the Personal folder). This constant is only supported by Windows 98, NT 4.0, and later.

Other Constants

{\}
A backslash character. See the note at the top of this page for an explanation of what the difference between using "{\}" and only a "\" is.

{srcexe}
This constant is replaced by the full path name of the setup executable.

{%NAME}
Embeds an environment variable, where NAME is the name of the variable to use. If the specified variable does not exist on the user's system, the constant will be replaced with an empty string.

{groupname}
The name of the group the user selected on Setup's Select Program Group wizard page. This differs from {group} in that it is only the name -- it does not include a path.

{olddata}
Used with the Registry data value (when the value is a STRING or EXPANDSZ type) the {olddata} parameter is replaced by the registry value which previously existed. Useful if you want to add to an existing string entry. For example if the existing registry value is "c:\program files", the entry "{olddata}\ver 1.0" would make the new registry entry "c:\program files\ver 1.0".

Member of
International Freeware Authors Association
International Freeware
Authors Association
Site Created with TaFWeb Software's PageBuilder




Copyright © 2005

Last major revision: 4 February 2005 at 14:52 BST
This page URL: http://www.tafwebsoftware.co.uk/smtutapp1.html