Question How can I create a launch condition based on an system search?
Does your installation have specific requirements before the installation executes, such as the existence of a specific operating system or the installation of another application? By creating launch conditions, you can specify certain requirements for your installation. Launch conditions are system requirements that your installation needs to run successfully. If the requirements are not met, your installation displays a message to the user and then terminates.
You can easily specify the following system requirements by using the System Requirements page in Installation Expert
Windows Version Windows NT Version Screen Resolution Screen Colors Internet Explorer Version Windows Installer Runtime Version
To create additional system requirements, you can search the system and use the result to set a launch condition. For example, your application requires that the software, RequiredApplication, needs to be installed on the destination computer. Due to this requirement, your installation verifies if RequiredApplication is installed. If RequiredApplication is not on the computer, a message appears that states the requirements are not met, and then the installation is aborted.
Before modifying your installation, establish a registry key or file that is unique to RequiredApplication. To determine if RequiredApplication is installed, the installation searches for this file or registry key. The following steps demonstrate how to create a search using the System Search page in Installation Expert. You can then use that search to create a launch condition.
In the following procedure, you will search for the registry value InstallationPath in the registry key HKEY_LOCAL_MACHINE\Software\RequiredApplication. If the search locates this registry key, the installation recognizes that RequiredApplication installed on the destination computer.
To create a system search:
Open Wise for Windows Installer, Wise for Visual Studio .NET, or Windows Installer Editor in Wise Package Studio.
From the File menu, select Open to open your .WSI/.MSI project file.
In Installation Expert, click the Systems Search page.
Click Add, and then select Registry. The Read Registry Value dialog appears.
In the Read Registry Value dialog, enter the following in the fields:
Property: SEARCHRESULTS This property contains the value of the registry key after the search completes. If the registry key value is not found, the property value is NULL. Operation: Select Read raw value from registry. Root: Select HKEY_LOCAL_MACHINE Key: Software\RequiredApplication Required Application Enter the desired registry key in the Key field. Make sure to use backslashes (\) to define the path. Value Name: InstallationPath Enter the desired value name in this field.
Click OK to save the entry on the System Search page.
This search sets the criterion that determines whether the installation continues or aborts. Now, you add a launch condition based on this search result. To create a launch condition:
Click the Product tab in Setup Editor.
Right-click Launch Conditions.
From the right-click menu, select New > Launch Condition. The Launch Condition Details dialog appears.
In the Launch Conditions Details dialog, enter the following information in the fields:
Condition: SEARCHRESULTS This is the property you entered in the Property field on the Read Registry Value dialog when creating a system search. The property, SEARCHRESULTS, is only defined if the search was successful. As long as SEARCHRESULTS contains a value, the condition evaluates to TRUE. If the registry key was not found, then SEARCHRESULTS will be NULL, and the condition will evaluate to FALSE. Message Text: RequiredApplication is Required Application installed on this computer. The installation will abort. The message text displays to the user in the event the condition is FALSE.
Click OK to save the launch condition.
Note: When populating the condition field of the dialog be sure to "List the condition that has to be met for your installation to 'continue' and the error message that appears when the condition is 'not met'.
Note: Do not add the property that you entered in the Read Registry Value dialog (SEARCHRESULTS) to the Property table. If you do add the property to this table, it always has a value since the property was created during design time. This causes the condition to always be true even if the launch condition is not met.
By default, the AppSearch action appears after the LaunchConditions action, which evaluates each launch condition added on the Product tab in Setup Editor. Because the AppSearch action performs the searches created on the System Search page, this action needs to occur before the LaunchConditions action. The following procedure lets you modify the sequence of these actions.
To modify the LaunchConditions action sequence:
In MSI Script, click the User Interface tab.
Find the AppSearch action. To quickly locate this action, select Find from the Edit menu, and enter AppSearch in the Find What field.
Select the AppSearch action and then click the Move Up button on the toolbar until the AppSearch action appears before the LaunchConditions action. By default, the LaunchConditions action is the first action in the script.
Note: If your .MSI supports silent installation, complete these steps in the Execute Immediate sequence. During a silent installation, the User Interface sequence does not execute.
By creating a launch condition based on a system search, you have the ability to control whether an installation runs or aborts based upon system requirements. Launch conditions save time in troubleshooting, eliminates unnecessary aborted installations, and gives you greater control over the installation.
Imported Document ID: HOWTO1086
Subscribing will provide email updates when this Article is updated. Login is required.