Writing Object Expressions in Advanced UI and Suite/Advanced UI Projects to Search Target Systems

InstallShield 2015

Project: This information applies to the following project types:

Advanced UI
Suite/Advanced UI

Edition: The Advanced UI project type is available in the Professional edition of InstallShield. The Suite/Advanced UI project type is available in the Premier edition of InstallShield. For information about the differences between these two project types, see Advanced UI Projects vs. Suite/Advanced UI Projects.

In various settings of Advanced UI and Suite/Advanced UI projects, you can embed object expressions to query target systems for information about a file, a registry entry, or other items. Object expressions use this convention:

[@Object(Parameters, ...).Property(Parameters, ...)]

Each object expression contains a reference to an object, which is a collection of object-specific properties. Objects and properties may contain parameters.

For example, the following Platform object expression obtains the architecture (x86, x64, IA64, ARM, or Unknown) of the machine on which the Advanced UI or Suite/Advanced UI installation is running:

[@Platform.Architecture]

The following Package object expression obtains the exit code for the package that has a package GUID of 0F283EC0-E9D1-4D18-801D-0014F6CA96DF once its scheduled operation has completed:

[@Parcel(0F283EC0-E9D1-4D18-801D-0014F6CA96DF).ExitCode]

Guidelines for Writing Object Expressions

Note the following guidelines when you are writing object expressions:

Syntax errors, failures of objects in object expressions, and invalid formatted expressions evaluate to an empty string at run time. In some cases, information about the failure to parse and evaluate a formatted expression is logged in the debug log file of the Advanced UI or Suite/Advanced UI installation.
You can embed object expressions within other formatted expressions, such as within property expressions or other object expressions.

In the following expression, a Registry object expression is embedded as part of the parameter to a File object expression.

[@File([@Registry(HKLM\Software\MyProduct).KeyValue(MyProductPath)]\MyProduct.exe).Version]

If the MyProduct.exe file is in the location that is specified for the MyProductPath value data, the File object expression returns the version of the file. If the file is not found in that location, or if the registry value does not exist, the File object expression returns an empty string.

You can embed property expressions and other formatted expressions within a parameter of an object expression.

The following File object expression obtains the last modified date and time for a file called MyProduct.exe, which is in the 32-bit ProgramFilesFolder. (Note that the parameter value of false indicates that the installation should not check 64-bit locations.)

[@File([ProgramFilesFolder]MyCompany\MyProduct.exe,false).Date(modified)]

The formatted expression parser for Advanced UI and Suite/Advanced UI installations does not require quotation marks. For example, if a parameter in an object expression includes a path or other item that contains one or more spaces, it is not necessary to enclose the path within quotes.
If you need to include literal square brackets, parentheses, or commas within a parameter of an object expression, embed in the parameter a formatted property expression ([SpecialCharacterString]) or an escaped character expression (A[\,] B[\,] and C) that would resolve to a value that contains the special characters.
You can use object expressions to perform system searches. You can use the output of one search as the input to a parameter in a different object expression.
The run-time resolution of object expressions involves two different steps: parsing and evaluation. A parameter in an object expression is parsed first at run time, just as any formatted expression would be parsed. After an entire formatted expression is parsed, the parsed output is then evaluated. No further parsing occurs after the initial parsing is done.

Thus, if the value of the expression [MYPROP] is [MYPROP], [MYPROP] becomes the parsed output that is evaluated on target systems. This scenario does not result in a recursive lookup.

For additional sample object expressions, as well as detailed information about each of the available objects, see Object Reference for Expressions in Advanced UI and Suite/Advanced UI Projects.

See Also