InstallShieldExpress启动JScript自定义操作:是否可以访问变量[INSTALLDIR]

时间:2021-07-20 22:38:03

I am discovering InstallShield Express (2011 version 17). Nice enough, it is possible to configure some custom actions. Namely, I can launch JScript scripts(seems to be a Javascript dialect, files ending in *.js).

我发现了InstallShield Express(2011版17)。很好,可以配置一些自定义操作。也就是说,我可以启动JScript脚本(似乎是一个Javascript方言,文件以* .js结尾)。

My script does some regedit stuffs, launches msiexec for installing MSXML, and executes an exe for installing security-dongle drivers... The overall is rather nice... But I am feeding the WScript.Shell commands with hard coded paths. I never like that.

我的脚本做了一些注册工作,启动msiexec安装MSXML,并执行安装安全加密狗驱动程序的exe ...总体来说相当不错......但我正在用硬编码路径提供WScript.Shell命令。我从不喜欢那样。

So as to be smarter, I would like to know if the InstallShield Express property [INSTALLDIR] could be accessed by some sort of InstallShieldObject inside the *.js

为了更聪明,我想知道是否可以通过* .js中的某种InstallShieldObject访问InstallShield Express属性[INSTALLDIR]

so as I could write something like:

所以我可以这样写:

function doInstall()
{
    installDir = InstallShieldObject.INSTALLDIR // <= this is what I'd like to do
    var comandUpdateRegistry = "regedit /s" + installDir + "registryScript.reg"

    oShell = WScript.CreateObject( "WScript.Shell" );
    oShell.Run( updateRegistryScriptCommand );

    return true;
}

1 个解决方案

#1


1  

Do you understand that what you are doing violates several best practices? If you do, or you don't care, then take a look at the Session object.

你明白你在做什么违反了几个最佳做法吗?如果您这样做,或者您不在乎,那么请查看Session对象。

Session Object Session.Property("MYPROP" ) Get; Set;

会话对象Session.Property(“MYPROP”)获取;组;

If you didn't know and/or you do care, then realize that 1) Script custom actions are fragile and 2) MSI is declarative not imperative. You shouldn't reinvent the wheel with a custom action soemthing that can be done natively using the Registry table.

如果您不知道和/或您确实关心,那么请认识到1)脚本自定义操作是脆弱的2)MSI是声明性的而不是必要的。您不应该使用自定义操作重新创建*,这可以使用Registry表本机完成。

In the context of InstallShield, you can right click import a Reg file into the registry table and MSI will take care of the rest for you.

在InstallShield的上下文中,您可以右键单击将Reg文件导入到注册表中,MSI将为您完成剩下的工作。

#1


1  

Do you understand that what you are doing violates several best practices? If you do, or you don't care, then take a look at the Session object.

你明白你在做什么违反了几个最佳做法吗?如果您这样做,或者您不在乎,那么请查看Session对象。

Session Object Session.Property("MYPROP" ) Get; Set;

会话对象Session.Property(“MYPROP”)获取;组;

If you didn't know and/or you do care, then realize that 1) Script custom actions are fragile and 2) MSI is declarative not imperative. You shouldn't reinvent the wheel with a custom action soemthing that can be done natively using the Registry table.

如果您不知道和/或您确实关心,那么请认识到1)脚本自定义操作是脆弱的2)MSI是声明性的而不是必要的。您不应该使用自定义操作重新创建*,这可以使用Registry表本机完成。

In the context of InstallShield, you can right click import a Reg file into the registry table and MSI will take care of the rest for you.

在InstallShield的上下文中,您可以右键单击将Reg文件导入到注册表中,MSI将为您完成剩下的工作。