Is

InstallShield 2018 » InstallScript Language Reference

The Is function retrieves information commonly needed in a script.

Syntax

Is ( nIsFlag, szIsData );

Parameters

Is Parameters

Parameter

Description

nIsFlag

Specifies the type of information to retrieve. Pass one of the following predefined constants in this parameter:

BACKBUTTON—Is the Back button that is displayed in some built-in dialogs enabled?
CANCELBUTTON—Is the Cancel button that is displayed in some built-in dialogs enabled?
DOTNETFRAMEWORKINSTALLED—Is a particular version of the .NET Framework or language pack installed? For more information on the predefined values that are supported, see the Additional Information section.
DOTNETSERVICEPACKINSTALLED—Is a particular service pack—or a later version of the service pack—of the .NET Framework installed? For more information on the predefined values that are supported, see the Additional Information section.
DIR_WRITEABLE—Can the installation write to the directory that is specified in szIsData?
FILE_EXISTS—Does the file that is specified in szIsData exist?
FILE_LOCKED—Is the file locked? Note that Is returns TRUE if the file is not accessible because of insufficient privileges.
FILE_WRITEABLE—Can the installation write to the file specified in szIsData?
FONT_AVAILABLE—Is the font with the title that is specified in szIsData installed? Note that the function searches for the font in all character sets. To search in a single character set, call the Windows API function EnumFontFamiliesEx; for details on this function, see Microsoft's Windows API documentation.
FUNCTION_EXPORTED—Does the DLL that is specified in szIsData export the function specified in szIsData? Is returns TRUE if the DLL exists and can be loaded, and if the function is exported. Otherwise, Is returns FALSE.
LANGUAGE_SUPPORTED—(InstallScript and InstallScript MSI projects) Does the installation support the language that is specified in szIsData?
LOGGING—(InstallScript projects only) Is logging of uninstallation information enabled?
MATH_COPROCESSOR—Does a math coprocessor exist in the target system?
NEXTBUTTON—Is the Next button that is displayed by some built-in dialogs enabled? On most dialogs, the Next button is enabled by default.
PATH_EXISTS—Does the path that is specified in szIsData exist?
REGDBREMOTEREGCONNECTED—Is a remote registry currently connected?
REBOOTED—Is the installation running after a reboot?

nIsFlag (cont.)

SETUP_PACKAGE—(InstallScript projects only) Is the setup running from a self-extracting executable file?

During maintenance mode or during uninstallation, Is(SETUP_PACKAGE, szIsData) returns TRUE if the original installation was a self-extracting executable file (although maintenance or uninstallation runs not from the self-extracting executable file, but from the copy of Setup.exe in the DISK1TARGET folder).

SKIN_LOADED—Is a dialog skin loaded?
URL—Is the string that is specified in szIsData a URL? (That is, does the string begin with "http://" or "https://" or "file://" or "ftp://"?)
USER_ADMINISTRATOR—Does the current user have administrator privileges? Is returns TRUE when USER_ADMINISTRATOR is passed in nFlag in all cases, except for some cases on Windows Vista and later systems; on these later systems, Is returns TRUE if the USER_ADMINISTRATOR is passed in nFlag and the SE_GROUP_USE_FOR_DENY_ONLY security identifier (SID) attribute is not set for the group. That is, if the current user is in the Administrators group but that user is running the installation with a standard access token on Windows Vista or later, Is returns FALSE.
USER_INADMINGROUP—Is the current user in the Administrators group? Is returns TRUE for this constant, regardless of whether the SE_GROUP_USE_FOR_DENY_ONLY SID attribute is set for the group (that is, regardless of whether the user with administrative privileges is running the installation with a standard access token).
USER_POWERUSER—Does the current user belong to the Power Users group?
VALID_PATH—Is the path specified in szIsData a legal path? This will not confirm the existence of a path, it will only check its syntax. You can use this constant when you retrieve path information from the user. The function will then check to see if the path information was entered correctly.

A valid URL string meets the following criteria: (1) It begins with http://, https://, or file://. (2) It contains only numbers, letters, and the following characters: ! $ % & ' ( ) * + - . / \ _

nIsFlag (cont.)

WEB_BASED_SETUP—(InstallScript projects only) Is the installation being run from the Internet?

Note • Is(WEB_BASED_SETUP,szIsData) checks whether the current instance of the installation is being run from the Web. For this reason, when the installation is run from Add or Remove Programs, Is(WEB_BASED_SETUP,szIsData) always returns FALSE, since in that case the installation is always being run from the local files even if the original installation was run from the Web.

WINDOWS_SHARED—Is Microsoft Windows running a shared copy from a network?

A shared copy of Microsoft Windows is installed on a network and has common files that are shared by many users.

szIsData

Specifies information that is dependent on the constant that is passed in nIsFlag, as shown below. Note that if the path or file name is enclosed in quotation marks, Is fails. To ensure that the path or file name is not enclosed in quotation marks, call LongPathToQuote(szIsData, FALSE) before calling Is. The following list provides an explanation of what szIsData should contain when each nIsFlag option is specified:

DIR_WRITEABLE—szIsData specifies the fully qualified path to be checked.
DOTNETFRAMEWORKINSTALLED—szIsData specifies the version of the .NET Framework or language pack to check. For more information on the predefined values that are supported, see the Additional Information section.
DOTNETSERVICEPACKINSTALLED—szIsData specifies the minimum service pack and version of the .NET Framework to check, in the following format:

Service Pack Number|.NET Version Registry Constant or Path

Service Pack Number indicates the number of the minimum service pack. For the .NET Framework 1.0, the value can be 0 through 3. For the .NET Framework 1.1 and later, all numeric values are supported. Both the service pack number and the pipe character (|) delimiter must be included; otherwise, the function returns failure.

.NET Version Registry Constant or Path indicates the registry constant or registry path that shows the version of the .NET Framework to check. For more information on the predefined values that are supported and to learn how the Is function performs the check, see the Additional Information section.

FILE_EXISTS—szIsData specifies the fully qualified file name. You can specify a valid URL in this parameter. To check the validity of a URL, call Is(VALID_PATH, szIsData).
FILE_LOCKED—szIsData specifies the fully qualified file name.
FILE_WRITEABLE—szIsData specifies the fully qualified file name.
FONT_AVAILABLE—szIsData specifies the font title.
FUNCTION_EXPORTED—szIsData specifies the fully qualified file name of the DLL followed by a pipe character (|) and the name of the function; for example:

C:\\MyDLLFolder\\MyDLL.dll|MyFunction

LANGUAGE_SUPPORTED—szIsData specifies the path to the Setup.ini file and the language ID, in the following format:

Path to Setup.ini|Language ID

If the path to Setup.ini is not specified, the current installation is used. If the language ID is not specified, SELECTED_LANGUAGE is used.

The language ID should be a four-digit hexadecimal language code, including the 0x prefix. For example, if for English, the value should be 0x0409. To build a string with STANDARD_SELECTED_LANGUAGE in this format, use a statement such as:

Sprintf (szLang, "0x%.04lx", STANDARD_SELECTED_LANGUAGE);

szIsData (cont.)

LOGGING—szIsData is ignored.
MATH_COPROCESSOR—szIsData specifies szIsData is ignored.
PATH_EXISTS—szIsData specifies the fully qualified path. You can specify a valid URL in this parameter. To check the validity of a URL, call Is(VALID_PATH, szIsData).
REGDBREMOTEREGCONNECTED—szIsData is ignored.
SETUP_PACKAGE—szIsData is ignored.
SKIN_LOADED—szIsData is ignored.
USER_ADMINISTRATOR—szIsData is ignored.
USER_POWERUSER—szIsData is ignored.
VALID_PATH—szIsData specifies the fully qualified path.
WEB_BASED_SETUP—szIsData is ignored.
WINDOWS_SHARED—szIsData is ignored.

Return Values

Is Return Values

Return Value

Description

TRUE (1)

Indicates that the answer is true.

FALSE (0)

Indicates that the answer is false.

< 0

The Is function was unable to answer the question.

Additional Information

.NET Framework Version and Service Details

The following predefined constants are supported for specifying a particular version of the .NET Framework using DOTNETFRAMEWORKINSTALLED or DOTNETSERVICEPACKINSTALLED:

REGDB_KEYPATH_DOTNET_40_CLIENT
REGDB_KEYPATH_DOTNET_40_FULL
REGDB_KEYPATH_DOTNET_35
REGDB_KEYPATH_DOTNET_30_SP—Use this variable to detect whether the SP1 (or a later service pack) of the .NET Framework 3.0 is installed.
REGDB_KEYPATH_DOTNET_30—Use this variable to detect whether the RTM version of the .NET Framework 3.0 is installed.
REGDB_KEYPATH_DOTNET_20
REGDB_KEYPATH_DOTNET_11
REGDB_KEYPATH_DOTNET_10

Tip • Since each of these predefined constants correspond to the appropriate registry path under HKEY_LOCAL_MACHINE, you can also specify a registry path directly in szIsData for DOTNETFRAMEWORKINSTALLED or DOTNETSERVICEPACKINSTALLED.

The installation of the .NET Framework 3.0 writes the registry value InstallSuccess, with 1 as the value data, in the following registry location:

HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup\

Therefore, REGDB_KEYPATH_DOTNET_30 is set to that location.

The installations of all other versions of the .NET Framework write the registry value Install with a value data of 1 in the following registry location:

HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\Version Number\

The REGDB_KEYPATH_DOTNET_35, REGDB_KEYPATH_DOTNET_20, REGDB_KEYPATH_DOTNET_11, and REGDB_KEYPATH_DOTNET_10 constants are set to the appropriate values, based on that path.

Note that the installation of the .NET Framework 3.0 SP1 also writes the registry value Install with a value data of 1 in the following registry location:

HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\

Therefore, REGDB_KEYPATH_DOTNET_30_SP is set to that location.

If you use the Is function with the DOTNETFRAMEWORKINSTALLED constant, the function automatically checks for both the Install and InstallSuccess values. If the Install or InstallSuccess value exists and its value data is set to 1, Is returns TRUE. Otherwise, Is returns FALSE.

The .NET Framework 1.0 service pack installations do not create registry values that indicate the service pack number. Therefore, if you use DOTNETSERVICEPACKINSTALLED to test for the .NET Framework 1.0, the Is function compares the version of the mscorlib.dll file in FOLDER_DOTNET_10 against known version numbers to determine the service pack:

SP3 is present if the version of mscorlib.dll is 1.0.3705.6018 or later.
SP2 is present if the version of mscorlib.dll is 1.0.3705.288 or later, but earlier than 1.0.3705.6018.
SP1 is present if the version of mscorlib.dll is 1.0.3705.209 or later, but earlier than 1.0.3705.288.
The original RTM version is present if the version of mscorlib.dll is 1.0.3705.0 or later, but earlier than 1.0.3705.209.

If you use DOTNETSERVICEPACKINSTALLED to test for any of the other .NET Framework versions, the function compares the REGDB_VALUENAME_SP value under the .NET version registry constant or path that is specified in szIsData with the service pack number that is specified in szIsData. Note that the comparison is an equal-to-or-later-than version comparison; therefore, if you specify a service pack of 2 in szIsData, the function returns true whenever service pack 2 or later is installed.

.NET Framework Language Pack Details

Version 1.1 and later of the .NET Framework includes support for language packs; version 1.0 does not. For version 1.1 and later of the .NET Framework, you can test whether a particular .NET language pack is installed through the DOTNETFRAMEWORKINSTALLED constant by specifying the appropriate .NET version constant and the locale identifier (LCID) of the language (converted to a string). Separate the .NET version constant and the LCID with the caret operator. For example, use the following syntax to test whether the German language pack for .NET Framework 1.1 is installed:

NumToStr( szLang, ISLANG_GERMAN_STANDARD );

REGDB_KEYPATH_DOTNET_11 ^ szLang;

As documented by Microsoft, the .NET Framework 1.1 supports the following LCIDs:

Supported .NET LCIDs

Language

LCID

Corresponding Is Constant

Chinese (Simplified)

2052 (0x0804)

ISLANG_CHINESE_SIMPLIFIED

Chinese (Traditional)

1028 (0x0404)

ISLANG_CHINESE_TRADITIONAL

Czech

1029 (0x0405)

ISLANG_CZECH_STANDARD

Danish

1030 (0x0406)

ISLANG_DANISH_STANDARD

Dutch

1043 (0x0413)

ISLANG_DUTCH_STANDARD

Finnish

1035 (0x040B)

ISLANG_FINNISH_STANDARD

French

1036 (0x040C)

ISLANG_FRENCH_STANDARD

German

1031 (0x0407)

ISLANG_GERMAN_STANDARD

Greek

1032 (0x0408)

ISLANG_GREEK_STANDARD

Hungarian

1038 (0x040E)

ISLANG_HUNGARIAN_STANDARD

Italian

1040 (0x0410)

ISLANG_ITALIAN_STANDARD

Japanese

1041 (0x0411)

ISLANG_JAPANESE_STANDARD

Korean

1042 (0x0412)

ISLANG_KOREAN_STANDARD

Norwegian

1044 (0x0414)

ISLANG_NORWEGIAN_BOKMAL

Polish

1045 (0x0415)

ISLANG_POLISH_STANDARD

Portuguese (Brazilian)

1046 (0x0416)

ISLANG_PORTUGUESE_BRAZILIAN

Portuguese (Portugal)

2070 (0x0816)

ISLANG_PORTUGUESE_STANDARD

Russian

1049 (0x0419)

ISLANG_RUSSIAN_STANDARD

Spanish

3082 (0x0C0A)

ISLANG_SPANISH_MODERNSORT

Swedish

1053 (0x041D)

ISLANG_SWEDISH_STANDARD

Turkish

1055 (0x041F)

ISLANG_TURKISH_STANDARD

See Also