确定InstallShield 2012中的Excel位数

我正在使用InstallShield 2012 for Excel加载项构build安装包。 由于MS Excel具有32位版本和64位版本,因此我需要分别构build安装包。 理想情况下,在将文件复制到目标计算机之前,安装文件应该能够在安装的前几个步骤中检测Excel位(而不是Windows位)。 然而,经过一些在线广泛的研究,我还没有find确定Excel位的可靠方法。 任何人有一些想法,请随时提供帮助。 谢谢

下面是我使用的(LUA – Setup Factory)代码:即使没有安装Outlook,它也能正常工作。

-- check if 64 bit office installed s64_14 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\14.0\\Outlook","Bitness",true); s64_15 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\15.0\\Outlook","Bitness",true); s64_16 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\16.0\\Outlook","Bitness",true); bl64Bit = false; if (s64_14=="x64" or s64_15=="x64" or s64_16=="x64") then bl64Bit = true end -- check for 64-bit OS bl64BitOS=false; if SessionVar.Expand("%ProgramFilesFolder%") ~= SessionVar.Expand("%ProgramFilesFolder64%") then bl64BitOS=true end 

我和Advanced Installer用户有类似的讨论,你可以在我们的论坛上查看,用户想要检测Office的位数。

您应该创build2个属性以跟踪安装了哪个版本的Excel,然后将这些属性用作特征条件“EXCEL32_EXISTS = 0”。 这是我用来完成这个的代码,最初EXCEL32_EXISTS和EXCEL64_EXISTS都设置为0。

 Excel_Installed=FALSE; szKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\excel.exe"; if (RegDBKeyExist(szKey)=1) then Excel_Installed=TRUE; RegDBGetKeyValueEx ( szKey, "Path", nvType, ExcelPath, nvSize ); SprintfMsiLog( "Found Excel @ %s", ExcelPath ); if ( StringContains(ExcelPath, "Office11")=TRUE ) then Excel_Installed=FALSE; elseif ( SYSINFO.bIsWow64=FALSE ) then MsiSetProperty(hMSI, "EXCEL32_EXISTS", "1"); elseif ( (StringContains(ExcelPath, "(x86)")=TRUE) || (StringContains(ExcelPath, "Office12")=TRUE) ) then MsiSetProperty(hMSI, "EXCEL32_EXISTS", "1"); else MsiSetProperty(hMSI, "EXCEL64_EXISTS", "1"); endif; endif; export prototype BOOL StringContains(STRING,STRING); function BOOL StringContains(szSource, szArgs) BOOL bContains; begin if(szSource % szArgs) then bContains = TRUE; else bContains = FALSE; endif; return bContains; end;