如何根据vbscript自定义操作结果中止InstallShield安装?

时间:2021-04-07 22:39:31

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.

我创建了一个vbscript自定义操作,它检查一些注册表项并在必要时更改它们。如果无法写入密钥或类似的密钥,则应中止设置。

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?

所以问题是:我如何根据我的自定义操作说明实现安装中止?有没有一种方法可以将“中止安装请求”传递给安装程序或类似的东西?

2 个解决方案

#1


3  

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上搜索,您将找到Robert Dickau撰写的题为“从自定义操作中退出MSI安装”的文章。它位于以下链接:

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

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.

祝你好运。

#2


0  

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

您应该从函数返回3表示失败,0或1表示成功。

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

这是关于该主题的msdn文章:http://msdn.microsoft.com/en-us/library/aa371254(VS.85).aspx

Make sure you put your script in a function.

确保将脚本放在函数中。

#1


3  

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上搜索,您将找到Robert Dickau撰写的题为“从自定义操作中退出MSI安装”的文章。它位于以下链接:

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

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.

祝你好运。

#2


0  

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

您应该从函数返回3表示失败,0或1表示成功。

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

这是关于该主题的msdn文章:http://msdn.microsoft.com/en-us/library/aa371254(VS.85).aspx

Make sure you put your script in a function.

确保将脚本放在函数中。