Custom actions written in JScript or VBScript can call an optional function. These functions must return one of the values shown in the following table.
Return value | Value | Description |
---|---|---|
msiDoActionStatusNoAction | 0 | Action not executed. |
msiDoActionStatusSuccess | IDOK = 1 | Action completed successfully. |
msiDoActionStatusUserExit | IDCANCEL=2 | Premature termination by user. |
msiDoActionStatusFailure | IDABORT = 3 | Unrecoverable error. Returned if there is an error during parsing or execution of the Jscript or VBScript. |
msiDoActionStatusSuspend | IDRETRY = 4 | Suspended sequence to be resumed later. |
msiDoActionStatusFinished | IDIGNORE=5 | Skip remaining actions. Not an error. |
Note that Windows Installer translates the return values from all actions when it writes the return value into the log file. For example, if the action return value appears as 1 (one) in the log file, this means that the action returned msiDoActionStatusSuccess. For more information about this translation see Logging of Action Return Values.
To return a value other than success from a script custom action, you must use a function target for the custom action. The target function is specified in the Target column of the CustomAction Table.
The following script example shows you how to return success or failure from a VBScript custom action.
Function MyVBScriptCA()
If Session.Property("CustomErrorStatus") <> "0" Then
'return error
MyVBScriptCA = 3
Exit Function
End If
' return success
MyVBScriptCA = 1
Exit Function
End Function
If this VBScript were embedded in the Binary table of the installation package as MyCA.vbs, the CustomAction Table entry for the script would be the following:
Action | Type | Source | Target |
---|---|---|---|
MyCustomAction | 6 | MyCA.vbs | MyVBScriptCA |
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.