<%-- 判断是否安装文件--%>
function ifExist(appPath,appMain,OBJ_ID){
var filespec=appPath+"/"+appMain;
var fso=null;
try
{
fso=new ActiveXObject("Scripting.FileSystemObject");
}
catch(errorObject)
{
alert("请添加该站点为受信任的站点并修改其安全级别");
}
if(fso.FileExists(filespec))
runExecutable(appPath,filespec);
else{
window.open("<%=request.getContextPath()%>/portalController/downPortal.do?objId="+OBJ_ID);
}
}
<%--运行exe文件--%>
function runExecutable(appPath,filespec)
{
try
{
var shellActiveXObject= new ActiveXObject("WScript.Shell");
<%--设置工作目录--%>
shellActiveXObject.CurrentDirectory=appPath;
if (!shellActiveXObject )
{
alert('Could not getreference to WScript.Shell');
return;
}
shellActiveXObject.Run("\""+filespec,1, false);
shellActiveXObject = null;
}
catch (errorObject)
{
alert('Error:\n' +errorObject.message);
};
}