2024年1月8日发(作者:)
SetupFactory7 功能函数脚步--获取系统版本号
function GetOSVersion() local OS_Ver =
local Result = ersionInfo();
ersion.."."..ersion return OS_Verend
--获取WindowsInstaller版本 local WIVer=0;
local
function GetWindowsInstallerVersion()
WindowsInstallerFilePath=("%WindowsFolder%")..""
if(ist(WindowsInstallerFilePath)) then
WinInstallerInfo =
sionInfo(WindowsInstallerFilePath)
ver=rsion;
if(ver~="") then
WIVer=er((ver,1)); end end
return WIVer;end
--判断是否存在.NetFramWork2.0function ExistNetFW2()
DotNet_Registry =
yExist(HKEY_LOCAL_MACHINE,
"mework");
if (DotNet_Registry == false) then return false; end
DotNet_Install_Location =
ue(HKEY_LOCAL_MACHINE,
"mework", "InstallRoot", true);
Does_File_Exist =
DotNet_Install_Location.."v2.0.50727aspnet_";
if(ist(Does_File_Exist))then return true; else endend
--返回本机存在的Excel版本
return false;
function GetExistExcelVersion()
local ExistExcel2003=false; local ExistExcel2007=false; local ExistExcel2010=false;
--ExistExcel2003?
Excel2003Registry =
yExist(HKEY_LOCAL_MACHINE,
"SoftwareMicrosoftOffice11.0ExcelInstallRoot");
if(Excel2003Registry) then
Excel2003InstallPath =
ue(HKEY_LOCAL_MACHINE,
"SoftwareMicrosoftOffice11.0ExcelInstallRoot",
"Path", false);
Excel2003File=Excel2003InstallPath.."" if(ist(Excel2003File)) then ExistExcel2003=true; end end
--ExistExcel2007?
Excel2007Registry =
yExist(HKEY_LOCAL_MACHINE,
"SoftwareMicrosoftOffice12.0ExcelInstallRoot");
if(Excel2007Registry) then Excel2007InstallPath =
ue(HKEY_LOCAL_MACHINE,
"SoftwareMicrosoftOffice12.0ExcelInstallRoot",
"Path", false);
Excel2007File=Excel2007InstallPath.."" if(ist(Excel2007File)) then ExistExcel2007=true; end end
--ExistExcel2010?
Excel2010Registry =
yExist(HKEY_LOCAL_MACHINE,
"SoftwareMicrosoftOffice14.0ExcelInstallRoot");
if(Excel2010Registry) then
Excel2010InstallPath =
ue(HKEY_LOCAL_MACHINE,
"SoftwareMicrosoftOffice14.0ExcelInstallRoot",
"Path", false);
Excel2010File=Excel2010InstallPath.."" if(ist(Excel2010File)) then ExistExcel2010=true; end end
ExcelCheckTable={Excel2003=ExistExcel2003,Excel2007=ExistExcel2007,Excel2010=ExistExcel2010};
return ExcelCheckTable
end
--判断当前用户是否为系统管理员function isAdmin()
UserInfo = rInfo(); return nend
--禁用Windows7|Vista操作系统的UAC设置function DisableUAC()
UACRegistry = yExist(HKEY_LOCAL_MACHINE,
"SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem")
if(UACRegistry) then
--ue(HKEY_LOCAL_MACHINE,
"SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "ConsentPromptBehaviorAdmin", 0, REG_DWORD);
ue(HKEY_LOCAL_MACHINE,
"SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "EnableLUA", 0, REG_DWORD);
--ue(HKEY_LOCAL_MACHINE,
"SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "PromptOnSecureDesktop", 0, REG_DWORD); end
end
--判断UAC是否已经禁用
function isUACDisable() UACDisable=false;
UACRegistry = yExist(HKEY_LOCAL_MACHINE,
"SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem")
if(UACRegistry) then
State = ue(HKEY_LOCAL_MACHINE,
"SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "EnableLUA", true);
if(State==0) then else end end
return UACDisableend
--启用被Excel所禁用的聚源计算插件
UACDisable=true
UACDisable=false
function EnableExcelDisableGildataCalcAddin()
if(2003) then Excel2003DisableRegistry =
yExist(HKEY_CURRENT_USER,
local ExcelSetupInfo=GetExistExcelVersion()
"SoftwareMicrosoftOffice11.0ExcelResiliency");
if(Excel2003DisableRegistry) then
Key(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice11.0ExcelResiliency");
end end
if(2007) then Excel2007DisableRegistry =
yExist(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice12.0ExcelResiliency");
if(Excel2007DisableRegistry) then
Key(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice12.0ExcelResiliency");
end
RequireAddinSigValue2007 =
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice12.0ExcelSecurity",
"RequireAddinSig")
if(RequireAddinSigValue2007~="" and
RequireAddinSigValue2007~=0) then
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice12.0ExcelSecurity",
"RequireAddinSig", 0, REG_DWORD); end
DisableAllAddinsValue2007 =
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice12.0ExcelSecurity",
"DisableAllAddins")
if(DisableAllAddinsValue2007~="" and
DisableAllAddinsValue2007~=0) then
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice12.0ExcelSecurity",
"DisableAllAddins", 0, REG_DWORD); end
end
if(2010) then Excel2010DisableRegistry =
yExist(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice14.0ExcelResiliency");
if(Excel2010DisableRegistry) then
Key(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice14.0ExcelResiliency");
end
RequireAddinSigValue2010 =
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice14.0ExcelSecurity",
"RequireAddinSig")
if(RequireAddinSigValue2010~="" and
RequireAddinSigValue2010~=0) then
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice14.0ExcelSecurity",
"RequireAddinSig", 0, REG_DWORD); end
DisableAllAddinsValue2010 =
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice14.0ExcelSecurity",
"DisableAllAddins")
if(DisableAllAddinsValue2010~="" and
DisableAllAddinsValue2010~=0) then
ue(HKEY_CURRENT_USER,
"SoftwareMicrosoftOffice14.0ExcelSecurity",
"DisableAllAddins", 0, REG_DWORD); end
end
end
--判断Excle是否打开
WindowsProcessList = ateProcesses();
function isExcelOpen()
for j,file_path in WindowsProcessList do
local file = ath(file_path);
local
ProcessFileName=(me..ion)
if (ProcessFileName == "") then
return true
end
end
return false;
end
--写入日志文件
function WriteLog(strLog)
oLogFile(strLog.."rn", true);
end


发布评论