Wps_Path()
If @OSArch = "X64" Then
x64()
ElseIf @OSArch = "X86" Then
x86()
ElseIf @OSArch = "IA64" Then
MsgBox(0,"提示","暂不支持系统构架:"& @OSArch)
EndIf
Func Wps_Path()
$Wps_Path = RegRead('HKEY_CURRENT_USER\Software\Kingsoft\Office\6.0\Common','InstallRoot');获取WPS安装路径
If @error Then
$Wps_Path = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Kingsoft\Office\6.0\Common','InstallRoot');获取WPS安装路径
If @error Then
MsgBox(0,"提示","获取WPS安装路径失败!")
Exit
Else
EndIf
EndIf
;~ MsgBox(0,0,$Wps_Path)
Return $Wps_Path
EndFunc
Func x86();写入Excel.Application
;HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}
If RegEnumKey ('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}',1) <> "" Then ShellExecute('reg', 'export HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046} '&@ScriptDir&"\H_C_R_C.reg")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}',"","REG_SZ", "Microsoft Excel Application")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocHandler32',"","REG_SZ", "ole32.dll")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Assembly","REG_SZ", "Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Class","REG_SZ", "Microsoft.Office.Interop.Excel.ApplicationClass")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"RuntimeVersion","REG_SZ", "v2.0.50727")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Assembly","REG_SZ", "Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Class","REG_SZ", "Excel.ApplicationClass")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"RuntimeVersion","REG_SZ", "v2.0.50727")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"","REG_SZ", $Wps_Path&"\office6\et.exe /Automation")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',"","REG_SZ", "Excel.Application.12")
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\VersionIndependentProgID',"","REG_SZ", "Excel.Application")
;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}
If RegEnumKey ('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}',1) <> "" Then ShellExecute('reg', 'export HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046} '&@ScriptDir&"\H_L_M_S_C_C.reg")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}',"","REG_SZ","Microsoft Office Excel 应用程序")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocHandler32',"","REG_SZ","ole32.dll")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"","REG_SZ",$Wps_Path&"\office6\et.exe /Automation")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',".ksobak","REG_SZ","")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"LocalServer32","REG_MULTI_SZ", '"'&$Wps_Path&'\office6\et.exe" /Automation')
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',"","REG_SZ","Excel.Application.12")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',".ksobak","REG_SZ","Excel.Application.11")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\VersionIndependentProgID',"","REG_SZ","Excel.Application")
EndFunc
Func x64()
;HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}
If RegEnumKey ('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}',1) <> "" Then ShellExecute('reg', 'export HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046} '&@ScriptDir&"\H_C_R_W_C.reg")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}',"","REG_SZ","Microsoft Office Excel 应用程序")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocHandler32',"","REG_SZ","ole32.dll")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"","REG_SZ",$Wps_Path&"\office6\et.exe /Automation")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',".ksobak","REG_SZ","")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"LocalServer32","REG_MULTI_SZ", '"'&$Wps_Path&'\office6\et.exe" /Automation')
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',"","REG_SZ","Excel.Application.12")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',".ksobak","REG_SZ","Excel.Application.11")
RegWrite('HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\VersionIndependentProgID',"","REG_SZ","Excel.Application")
;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}
If RegEnumKey ('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}',1) <> "" Then ShellExecute('reg', 'export HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046} '&@ScriptDir&"\H_L_M_S_C_W_C.reg")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}',"","REG_SZ","Microsoft Office Excel 应用程序")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocHandler32',"","REG_SZ","ole32.dll")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"","REG_SZ",$Wps_Path&"\office6\et.exe /Automation")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',".ksobak","REG_SZ","")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"LocalServer32","REG_MULTI_SZ", '"'&$Wps_Path&'\office6\et.exe" /Automation')
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',"","REG_SZ","Excel.Application.12")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',".ksobak","REG_SZ","Excel.Application.11")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\{00024500-0000-0000-C000-000000000046}\VersionIndependentProgID',"","REG_SZ","Excel.Application")
;HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}
If RegEnumKey ('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}',1) <> "" Then ShellExecute('reg', 'export HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046} '&@ScriptDir&"\H_L_M_S_W_C_C.reg")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}',"","REG_SZ","Microsoft Office Excel 应用程序")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocHandler32',"","REG_SZ","ole32.dll")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Assembly","REG_SZ","Kingsoft.Office.Interop.Etapi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=15d99fb7f8fe5cb4")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"Class","REG_SZ","Excel.ApplicationClass")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\3.0.0.0',"RuntimeVersion","REG_SZ","v2.0.50727")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"","REG_SZ",$Wps_Path&"\office6\et.exe /Automation")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',".ksobak","REG_SZ","")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32',"LocalServer32","REG_MULTI_SZ", '"'&$Wps_Path&'\office6\et.exe" /Automation')
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',"","REG_SZ","Excel.Application.12")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\ProgID',".ksobak","REG_SZ","Excel.Application.11")
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{00024500-0000-0000-C000-000000000046}\VersionIndependentProgID',"","REG_SZ","Excel.Application")
EndFunc