Reading MSM property from parent MSI. - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

stevejones75
Posts: 4
Joined: Fri Jan 30, 2009 5:48 pm

Reading MSM property from parent MSI.

Hi,
I'm trying to read, from an MSI, a "property" contained within an imported merge module.
If the property's value is 1, the installation should continue; if it's zero, the installation must stop.
The MSM is supplied by a third party, so I can't be flexible on this.
The method I'm currently trying, is to write an inline JavaScript script, but whenever I build and run the installer, I always get the error "There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor."

if (Session.Property("PROPERTY_NAME")== 1) return 0; else return 1;
if (PROPERTY_NAME == 1) return 0; else return 1;
if (Session.Property("PROPERTY_NAME.MERGE_MODULE_GUID")== 1) return 0; else return 1;
if (PROPERTY_NAME.MERGE_MODULE_GUID == 1) return 0; else return 1;

What's the correct syntax? I'm not a JavaScript developer, so I'm shooting in the dark a bit here.
Is it possible - by any means - to achieve what I need?
Thanks,
- Steve.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Reading MSM property from parent MSI.

Hi Steve,

When importing a MSM into your project, its properties will be added in the "Install Parameters" page under this form:

Code: Select all

<property_name>.<module_guid>
Therefore, when you need to access a property from a merge module you can use the name of the property and the GUID of the merge module. I'm not very familiar with JavaScript, but in VBScript you can try using this code:

Code: Select all

Function VerifyProperty()
  Dim prop
  prop = Session.Property("MY_PROP.2AD68563_D388_4A83_B89A_2611096BF51E")
  if (prop = "1") Then
    VerifyProperty = 0
  else 
    VerifyProperty = 1602
  End If
End Function
In the above code you can replace "MY_PROP" with the name of your custom property and "2AD68563_D388_4A83_B89A_2611096BF51E" with the GUID of the merge module. If the property is not set to "1", the custom action will return the value "1602" which stands for user exit.

This code can be pasted in a .VBS file which can be added as an Attached custom action. In the "Function Name" field of this custom action (in the "Custom Action Properties" page) you can use "VerifyProperty".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”