How to access installer properties from deferred custom actions

Installer Properties are available only during the immediate stage of the install execution process. After this stage is complete all property values are set to empty strings.

The exception to this rule is the special CustomActionData property which keeps its values through all of the stages even during deferred, rollback and commit.

Property value during deferred

Getting an installer property value during the deferred, rollback or commit stage is a two-steps process:

1. During the immediate stage set the CustomActionData property to the value of the desired property/properties you want to access during the deferred action

NoteCertain custom actions in Advanced Installer have an Action Data field where you can set the value of CustomActionData.

2. Access the value of the CustomActionData property from your deferred action

Example

Let’s suppose you want to display the paths of your application folder and shortcut (APPDIR and SHORTCUTDIR properties) from a VBS deferred custom action.

  1. In Advanced Installer go to Custom Actions and add a new "Execute inline script code" custom action
  2. Place the action in Install Execution Stage after “Add Resources"
  3. In the Execution Time section select "When the system is being modified (deferred)"
  4. Set Action data to [APPDIR]|[SHORTCUTDIR]
  5. Set the Script type to Visual basic script (*.vbs)
  6. Copy and paste the code below into your custom action
dim actionData
dim dataArray

actionData = Session.Property("CustomActionData")       ' retrieve the "CustomActionData" value and store it in the actionData variable

dataArray = split (actionData, "|")                     ' parse the actionData text and extract the paths delimited by the "|" separator

for each x in dataArray                                 ' display the extracted paths
	MsgBox x
next

7. Run and install your project