Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to abort the setup through CA written in VBSc


3 replies to this topic

Malini

Malini
  • Members
  • 9 posts

Posted 16 April 2002 - 10:20

Hi,
  I need to to abort the setup through the CA written in Vbscript.If the function returns success installation should continue.If it returns failure then I need to abort the setup.
Eg:
 I have written a VBScript to check whether IIS is installed in target machine or not.If the function returns Success then I need  to continue the installation otherwise I need to abort the setup.

How to abort the setup depending on the return values of the function written in VBScript.

Thanks
Malini.

hteichert

hteichert
  • Members
  • 158 posts

Posted 17 April 2002 - 09:31

In the custom action wizard, leave the field "Ignore custom action return code" unchecked (or clear it if checked). In MSI docu search for "Custom Action Return Processing Options" to will info about custom action return codes.
h.teichert-ott

Christophe

Christophe
  • Members
  • 1 posts

Posted 18 April 2002 - 15:00

Hi,

I want to do the same thing that Malini.
i.e abort the installation process with a VBS. I looked in the manual but in don't find any reponses.

Do you have a little example ?

Thanks in advance
Christophe

hteichert

hteichert
  • Members
  • 158 posts

Posted 19 April 2002 - 10:27

First, I want to say something about searching for IE. I don't think it's a good idea to use a VBScript to search for it. Here on installsite Stefan wrote a short article about looking for IE. Take it and use it.
It also shows how to search for any other application.

OK, and now for the Scripting:

Lets create a CA with
Action: MyTestAction
Type: 6  (VBScript, immediate execution, wait for exit code)
Source: TestScript (points to "Scriptfile.vbs" in binary table)
Target: TestFunction (name of function to be called)

The script "ScriptFile.vbs" (must be included in binary table, with CA wizard this will be done automatically, but the value for "Source" will be generated):

---- SNIP ----

' The following consts define the possible retvals of a VBScript
' Function could not be executed / Action not executed:
const ERROR_FUNCTION_NOT_CALLED=1626
' Completed action successfully:
const ERROR_SUCCESS=0
' User canceled installation:
const ERROR_INSTALL_USEREXIT=1602
' Unrecoverable/Fatal error occurred:
const ERROR_INSTALL_FAILURE=1603
' Skip remaining actions (not sure about value):
const ERROR_NO_MORE_ITEMS=259

Function TestFunction
' anything that the func shall do
' (here is the real code .... )

' and now you have different options how to end:
If alllwentgood Then
 TestFunction = ERROR_SUCCESS
Else
 TestFunction = ERROR_INSTALL_FAILURE
End If
End Function

---- SNAP ----

You still have to insert the real actions and put the CA somewhere in the sequence tables (as needed).

Until now I only used ERROR_SUCCESS (everything went fine, continue install) and ERROR_INSTALL_FAILURE (fatal error, abort install), so I can't tell you how the installer behaves when using the other values.

Good Luck!
h.teichert-ott