Simply return 3 from your method/function and let your Custom Action "check" the return code. Whenever your Custom Action would get 3 from method/function, it would immediately Quit. Here is some sample code:
In WIX, declare your Custom Action like this: Note the value for “Return” attribute:
WIX: Custom Action Declaration
- <CustomAction Id="CheckAutoCAD"
- BinaryKey="MyCustomActions.vbs"
- VBScriptCall="GetInstalledAutoCAD"
- Execute="immediate"
- Return="check"
- />
Here is the VbScript function which would return 3 if it fails. And as Custom Action would ‘check’ for return code, it will read the return code:
VBScript Function
- Public Function GetInstalledAutoCAD()
- Const IDABORT = 3'If function returned this, MSI installation would be terminated immediately
- 'statements
- 'statements
- 'statements
- if Not AutoCADFound then
- Msgbox "Setup cannot find any required AutoCAD installation." & VbCrlf & _
- "Please install AutoCAD before installing this product",
- 16,
- "Missing Prerequiste"
- GetInstalledAutoCAD=IDABORT 'this would return 3 and may cause msi installer to quite immediately.
- else
- GetInstalledAutoCAD=0
- end if
- End Function
BTW, I never tried same with any JScript, but I think, if same would be returned by JScript, installer would quit as well.
No comments:
Post a Comment