View Full Version : How to write an Install Exec Condition?

02-15-2005, 01:32 AM

Can anyone please tell me how to set a condition to execute a EXE used in the Custom Actions based on the selections made in the SetupType dialog box. At present the EXE runs everytime no matter what the setuptype is. I am using InstallScript MSI project of InstallShield 10.5


02-15-2005, 07:12 AM
You would want to create a property in the Property Manager and set a value to it based on the selections that are made in the SetupType dialog. Just put the condition on the Condition field of the CA. If your property is ABC and if you want to run only when ABC is 1, then enter the condition as ABC=1. (To set the property through code, you will have to use MsiSetProperty function)

I think InstallShield sets a property based on what you select in the setup type dialog, but I haven't figured out how to use it (if it does work, that is).


02-15-2005, 07:32 AM

I am not sure that this is the best solution but what I suggest you is to do the following :

1 - define a property with a default value which corresponds to your need
2 - In your InstallScript, in the OnFirstUIBefore function after the selection of the setup type by the user, you set the value of this property using the MsiSetProperty function
3 - In the Direct editor node, select the InstallExecuteSequence table. In the row corresponding to your custom action, write a conditional statement which tests the value of the property.

I hope this will help

02-15-2005, 07:38 AM
Oops. As vikasv suggested you, use the condition field directly in the custom action property sheet instead of direct editor (direct editor is what I use for Custom actions defined in merge modules).