views:

1316

answers:

2

I created a vbscript custom action which checks for some registry keys and alters them if neccessary. In case a key could not be written or something like that, the setup should be aborted.

In order to achieve this, I set a property which I tried to use as a condition for the next step within the execute sequence but this does not work.

I found out that this can not work since the custom action cannot write the property at the time it is executed.

So the question is: How can I achieve an abort of installation depending on what my custom action says? Is there a method to pass an "abort installation request" to the Installer or something like that?

A: 

You should need return 3 from your function for a fail and 0 or 1 for success.

Here is a msdn article on the topic : http://msdn.microsoft.com/en-us/library/aa371254(VS.85).aspx

Make sure you put your script in a function.

Web
+1  A: 

If you search on http://community.installshield.com you'll find an article by Robert Dickau entitled "Exiting an MSI Installation from a Custom Action". It's at the following link:

http://community.installshield.com/showthread.php?p=418197

Here's the snippet of code he uses as his example:

Function ExitSetupFromVBS( )

Const IDABORT = 3

    ' ...do some work...

    ' abort the installation
    ExitSetupFromVBS = IDABORT

End Function

Good luck.

Ken
Works perfectly, thanks!
Marcus