версия 1.08
Option Explicit
Const strPathToUpgrade = "\\00.00.00.000\Offer$\"
Const strPathToUpgradeLib = "\\00.00.00.000\Offer$\Library\"
Const strPathToLibrary = "Library"
Const strSecurity = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Access\security\Level"
Const strSecurityJet = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\SandBoxMode"
Const strSecurityEXCEL = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security\Level"
Const PathToAccess = "c:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
DIM strPathToAccess
DIM strCurrentPath
DIM FSO
DIM File
DIM WshShell
DIM WshExec
'...
On Error Resume Next
Set WshShell = CreateObject("WScript.Shell")
'Понижаем безопасность
If WSHShell.RegRead(strSecurity) <> 1 Then
WSHShell.RegWrite strSecurity, 1, "REG_DWORD"
End If
If WSHShell.RegRead(strSecurityJet) <> 2 Then
WSHShell.RegWrite strSecurityJet, 2, "REG_DWORD"
End If
If WSHShell.RegRead(strSecurityEXCEL) <> 1 Then
WSHShell.RegWrite strSecurityEXCEL, 1, "REG_DWORD"
End If
If Err.Number <> 0 Then
Err.Clear
WSHShell.RegWrite strSecurityEXCEL, "", "REG_DWORD"
WSHShell.RegWrite strSecurityEXCEL, 1, "REG_DWORD"
End If
'Проверяем версию файла mde и библиотек, если есть обновление на сервере, то тянем их.
'.....
'====================
'Разбираемся с путем к MSACCESS.EXE
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.GetFile(PathToAccess)
If Err.Number > 0 then
Dim AccessShell
Set AccessShell = CreateObject("Access.Application")
strPathToAccess = AccessShell.sysCmd(9)
strPathToAccess = strPathToAccess & "MSACCESS.EXE"
Set AccessShell = nothing
Err.Clear
Else
strPathToAccess = PathToAccess
End If
strCurrentPath = Replace(WScript.ScriptFullName, WScript.ScriptName,"")
' Запускаем Offer.mde
Set WshExec = WshShell.Exec(strPathToAccess & " """ & strCurrentPath & "Offer.mde" & """" & " /cmd ""Moscow""" )
Set File = Nothing
Set WshExec = Nothing
Set WshShell = Nothing
Set FSO = Nothing
|