Summary
This article focuses on using VBScript custom actions to get or set the value of a property.Synopsis
This article focuses on using VBScript custom actions to get or set the value of a property.
Discussion
The Windows Installer Service provides a comprehensive array of properties that can be used with the setup for various purposes. Different properties can be used in different modes in the setup to perform different operations. Because there is no built-in support to access properties in Express, you can make use of VBScript custom actions to work around the limitation. The following code demonstrates setting and getting the value of a property via VBScript.
Setting a Property
Sub SetAProperty_fun
Session.Property("PROPERTYNAME")="property value"
MsgBox Session.Property("PROPERTYNAME")
End Sub
Getting a Property
Sub GetAProperty_fun
dim szStringVal
szStringVal = Session.Property("PROPERTYNAME")
MsgBox Session.Property("PROPERTYNAME")
End Sub
Note: In the above examples, PROPERTYNAME can be replaced by any Windows Installer property or a property created in the System Hardware Requirements section in Express 4.0 and higher IDE.
To include the above VBScript code in your Express project, follow these steps:
- Create a blank text file and call it setproperty.vbs.
- Open the setproperty.vbs file in Notepad and copy both the codes above in it.
- Create a VBScript custom action in your Express project that points to setproperty.vbs by following these steps:
- Select the Custom Actions view.
- Right-click on Custom Actions in the center panel and choose New VBScript and set the following attributes:
- File Name: Browse to the setproperty.vbs file on your system.
- Function Name: SetAProperty_fun (if you want to set a property) or GetAProperty_fun (if you want to get the value of a property).
- Invoke: Select when you want this VBScript to run. You can invoke this at any point in the setup. If you are setting a property, it is usually a good idea to invoke it anywhere before After Custom Setup Type Dialog. This ensures that your property is set before the setup starts installing files.
- File Name: Browse to the setproperty.vbs file on your system.
- Select the Objects/Merge Modules or Redistributable gallery under Specify Application Data in the Express IDE and check the VBScriptRunTime Merge Module. This merge module installs VBScript run-time files, which are needed to run a VBScript custom action.
- Select the Custom Actions view.
- Rebuild your release and run the setup.
Additional Information
To acquire a list of all Windows Installer properties available, see the Windows Installer Help topic Property Reference.
Related Articles
Retrieve and Set Properties in a VBScript Custom Action 15Number of Views Setting an MSI Property from VBScript Custom Action 5Number of Views Deferred Execution Custom Action Cannot Retrieve a Property Value 8Number of Views Getting and Setting a Property From InstallScript 8Number of Views VBScript Custom Action : Compare Serial number With User Input 4Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago