Microsoft VBScript runtime error: ActiveX component can‘t create object: ‘ISWiAuto21.ISWiProject‘

在用installshield2015出包的时候运行:

C:\Windows\SysWOW64\cscript.exe ImportExportString.vbs installshield\LCSInstallation\LCSInstallation.bak.ism installshield\LCSInstallation\stringTable.txt 2052 I

时报错:

Microsoft VBScript runtime error: ActiveX component can't create > object: 'ISWiAuto21.ISWiProject'

环境时Windows 64位,按照下面的解释:

64-bit Systems An important thing to note is the InstallShield
Automation Interface is a 32-bit interface so it must be loaded from a
32-bit process. If you are using a 64-bit machine, like most current
Windows operating systems, you will need to load the automation
interface through a 32-bit executable file. To do this you would
launch cscript.exe from the 32-bit system folder (SysWow64), which is
typically located at: C:\Windows\SysWOW64. If you do not you may
encounter the following error:

Microsoft VBScript runtime error: ActiveX component can’t create
object: ‘ISWiAuto21.ISWiProject’

应该使用64位下的C:\Windows\SysWOW64\cscript.exe运行,但是代码中已经使用了此处的运行程序,依然报错。

最后,发现原因时installshield的版本不对,按照下面的提示:

現在我們已經升級到windows 2012服務器和InstallShield
2014。我已經檢查了兩次,根據InstallShield,唯一需要的更改是ver號(17個更改為21)。

应该将代码中2014对应的21,改为2015版本对应的22,即:

Dim ISWIProject
Set ISWIProject = CreateObject("IswiAuto21.ISWiProject"): CheckError

修改为:

Dim ISWIProject
Set ISWIProject = CreateObject("IswiAuto22.ISWiProject"): CheckError
这个错误通常是由于缺少相关的组件或对象库引起的。在VBScript中,`System.Text.Encoding`是不可直接创建对象的。为了解决这个问题,可以使用`ScriptControl`对象来进行Base64编码。以下是修改后的代码示例: ```vbscript Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile("input.txt", True) strText = "这是要保存的字符串内容" objFile.Write strText objFile.Close Set objShell = CreateObject("Shell.Application") Set sourceFolder = objShell.NameSpace(".") Set compressedFile = sourceFolder.Items.Item("input.txt") zipPath = "compressed.zip" objShell.NameSpace(zipPath).CopyHere compressedFile Set objStream = CreateObject("ADODB.Stream") objStream.Type = 1 ' Binary objStream.Open objStream.LoadFromFile zipPath base64String = objStream.Read( -1 ) objStream.Close Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.DeleteFile zipPath Set scriptControl = CreateObject("MSScriptControl.ScriptControl") scriptControl.Language = "JScript" base64String = scriptControl.Eval("(function(){var base64EncodeChars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';var out='',i=0,len=base64String.length;while(i<len){var c1,c2,c3,enc1,enc2,enc3,enc4;c1=base64String.charCodeAt(i++);c2=base64String.charCodeAt(i++);c3=base64String.charCodeAt(i++);enc1=c1>>2;enc2=((c1&3)<<4)|(c2>>4);enc3=((c2&15)<<2)|(c3>>6);enc4=c3&63;if(isNaN(c2)){enc3=enc4=64;}else if(isNaN(c3)){enc4=64;}out=out+base64EncodeChars.charAt(enc1)+base64EncodeChars.charAt(enc2)+base64EncodeChars.charAt(enc3)+base64EncodeChars.charAt(enc4);}return out;})()") WScript.Echo base64String ``` 这段修正后的代码使用了`MSScriptControl.ScriptControl`对象来执行JScript代码进行Base64编码。它将字符串保存到txt文件中,将txt文件压缩为zip文件,然后将zip文件内容转换为Base64字符串并输出。 请确保在运行VBScript之前已经安装了相应的运行环境,如Windows操作系统。 希望这次能够解决问题!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值