VBS Custom Actions - Action Data - 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!

invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

VBS Custom Actions - Action Data

I'm using VBscript a lot in my project. Both under UI Custom Actions and InstallExecuteSequence. I've noticed that Attached Custom Actions under UI Custom Actions do not have Action Data while Attached Custom Actions under InstallExecuteSequence do. What is the subtle difference I'm missing?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VBS Custom Actions - Action Data

Hi,

As our user-guide says, "Action Data" field represents the value of the "CustomActionData" property. This property can be retrieved as a regular property inside Deferred custom actions
and it is available only for DLL, JScript and VBScript custom actions. Deferred custom actions can receive information about the installation process, mostly only embedded in the CustomActionData property.
You cannot access the value of a public property from a deferred custom action.

UI Custom Actions can only be immediate, so you can access directly the value of a public property, you don't have to use the special property CustomActionData as a link between the custom action and the properties.

Please let us know if you have other questions.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

Re: VBS Custom Actions - Action Data

As our user-guide says
Which part of the user guide are you referring to? I understand UI Custom Actions but not the one's with Action Data. Hoping the user guide goes more in depth.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VBS Custom Actions - Action Data

Hi,

My above explanation is based on the following article from the user-guide.

Please let me know if you have any questions.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

Re: VBS Custom Actions - Action Data

I've come to a better understanding of Action Data. But all I can say is, wow. Why? Why must you go from easily accessed individual variables when doing Immediate Execution to one long packed variable when doing Deferred that you have to parse? It's so cumbersome, it makes me feel like I'm doing something wrong. Was this the way Microsoft implemented it?

Basically I need to modify a database with information collected during setup. I'm passing about a dozen variables in the one string.

Is it possible to return a value(s) in Deferred mode? My code is broken up across files and is modular. It was painless when I was using Immediate Execution but now that I'm using Deferred it isn't so clear. Do I need to combine the functionality I need into one file? Or can I pass parameters between VBscripts in Deferred mode?

Fellow users... he's what you need to know.
1. In the Action Data field put all the properties you want. (e.g. [NAME][ADDRESS])
2. Copy a tab (I did it in Notepad) and paste it between each property.
3. Set Execution Options to Deferred
4. In your VBscript use the following code to access your data.

Code: Select all

	subStrings = Split(Session.Property("CustomActionData"), vbTab)

	i = 0
	msg = ""
	for each item in subStrings
		msg = msg & i & "=" & item & vbCrLf 
		i = i + 1
	next

	MsgBox msg

Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VBS Custom Actions - Action Data

Hi,
Was this the way Microsoft implemented it?
Yes, this is based on the standards provided by Microsoft. The following article explains more.
Is it possible to return a value(s) in Deferred mode?
I'm afraid not, setting a public property in deferred custom actions is pointless because it will not be set as expected.
Do I need to combine the functionality I need into one file? Or can I pass parameters between VBscripts in Deferred mode?
I'm afraid you cannot pass parameters/properties between deferred custom actions. This can be done only with Immediate custom actions.
The only solution is to try to combine all your scripts that would need to communicate through public properties in a single one.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”