The "ComponentFind" Command |
This command is used to find a component, if found the keypath directory is returned. Frequently used as a launch condition and also to determine an installation directory.
You would do this either to determine whether a particular product was installed or to determine where it (at least the component) installed (you may need to reference a file or install some files in the same location).
As the search is done via the "AppSearch" table entry, you may wish to modify the sequencing of this action.
You will need to examine the product's MSI using "ORCA" to obtain the component GUID and TYPE values (by examination of the "Component" table). If you don't have access to the original MSI (but it is installed) then you could look at the copy Windows Installer has cached (in "C:\Windows\Installer").
This command takes these parameters:
Be careful not to choose a shared component which might get installed by multiple products (unless thats what you want!).
Note that if you get the "TYPE" parameter wrong then the component search will fail even if it is actually installed.
I can only assume that since you can't specify other types that you can't search for components which have other types of keypaths.
The default for this parameter can be set via the DEFAULT_FIND_COMPONENT_TYPE macro. The initial value is "FILE".
If not specified then the existance of the property will be validated (the install will fail if it does not exist).
This value can be "" to indicate that no validation should take place (the property is not set to null).
If you have not used the "Default" parameter and the MSI needs to display an error message it will use a default message unless you specify what it should say with this parameter. Note that the message can contain MSI formatting or "CRLF".
The "Validate" parameter controls whether or not we will fail (displaying this message) if the file isn't found.
The default signature is the property name so if you make this meaningful then you probably don't need to use this parameter (except in the case where you might be populating the same property from two or more sources).
EXAMPLE |
In the following we will display a message if we can't find the required product (assume if Component installed, the product is).
#define MM_PATCH_COMPGUID {1634B63A-34AF-4B31-A38A-E3D383B4E8BC} ;;Patch.MMH (in ONE version of the MAKEMSI package!) #( <$ComponentFind PROPERTY="CI_PATCH" ComponentId="<$MM_PATCH_COMPGUID>" Message="The correct version (1.2.3.4) of Product X is not installed." > #)