|
|
|
|
'$History: RestoreVisu.vbs $
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 9 *****************
|
|
|
|
|
'User: Breitenc Date: 31.08.05 Time: 12:26
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'Firewall-L<>cher f<>r Liniendisplay und FRC
|
|
|
|
|
'Auf Default-Struktur gebracht
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 8 *****************
|
|
|
|
|
'User: Breitenc Date: 20.07.05 Time: 9:24
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 7 *****************
|
|
|
|
|
'User: Breitenc Date: 24.06.04 Time: 12:28
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'vwsund dxt-Dateien ber<65>cksichtigt
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 6 *****************
|
|
|
|
|
'User: Breitenc Date: 13.04.04 Time: 10:46
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 5 *****************
|
|
|
|
|
'User: Breitenc Date: 8.03.04 Time: 16:14
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 4 *****************
|
|
|
|
|
'User: Admin Date: 12.02.04 Time: 16:25
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 3 *****************
|
|
|
|
|
'User: Breitenc Date: 26.03.03 Time: 9:25
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'<27>nderung von J<>rg
|
|
|
|
|
'
|
|
|
|
|
'***************** Version 2 *****************
|
|
|
|
|
'User: Cbr Date: 24.03.03 Time: 16:35
|
|
|
|
|
'Updated in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
'Aufruf von Visu2000 Database
|
|
|
|
|
'
|
|
|
|
|
' ***************** Version 1 *****************
|
|
|
|
|
' User: Breitenc Date: 13.03.03 Time: 14:19
|
|
|
|
|
' Created in $/Bugfix/SaveAndRestore/Skripte
|
|
|
|
|
|
|
|
|
|
Option Explicit
|
|
|
|
|
Dim wshshell,fso,i,Fnct
|
|
|
|
|
Dim strPath,strSystemFolder,strWinFolder,strTempFolder
|
|
|
|
|
'----------------------------- Objekte erzeugen --------------------------------
|
|
|
|
|
i = 0
|
|
|
|
|
On Error Resume Next
|
|
|
|
|
Do
|
|
|
|
|
err.Clear
|
|
|
|
|
i = i+1
|
|
|
|
|
Set wshshell = CreateObject("WScript.Shell")
|
|
|
|
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
|
|
|
|
Set Fnct = CreateObject("Install.Functions")
|
|
|
|
|
WScript.Sleep 1000
|
|
|
|
|
Loop Until Err.Number = 0 OR i > 30
|
|
|
|
|
|
|
|
|
|
If Err.Number <> 0 Then
|
|
|
|
|
WScript.Quit
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
On Error Goto 0
|
|
|
|
|
|
|
|
|
|
'--------------------------- Standardpfade -------------------------------------
|
|
|
|
|
strPath = GetCurrentPath()
|
|
|
|
|
strSystemFolder = fso.GetSpecialFolder(1) & "\"
|
|
|
|
|
strWinFolder = fso.GetSpecialFolder(0) & "\"
|
|
|
|
|
strTempFolder = fso.GetSpecialFolder(2) & "\"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'------------------------------ Main -------------------------------------------
|
|
|
|
|
Dim strVisuDir,strVisiwinDir
|
|
|
|
|
strVisuDir = ExpandPath("%VISUDIR%","c:\Visu2000")
|
|
|
|
|
strVisiwinDir = ExpandPath("%Visiwindir%","c:\Visiwin")
|
|
|
|
|
|
|
|
|
|
If fso.FileExists("c:\Computer.ini") Then
|
|
|
|
|
Dim strResult,strKey
|
|
|
|
|
strResult = Fnct.GetIniString("CD1_Setup","MbDiagObj","c:\Computer.ini")
|
|
|
|
|
If strResult <> "" And fso.FolderExists(strVisuDir & "\PC_Diagnostics") Then
|
|
|
|
|
Call Fnct.SetIniString("run",strResult,"1",strVisuDir & "\Program\Visu2000.vwi")
|
|
|
|
|
strKey = "HKEY_LOCAL_MACHINE\SOFTWARE\INOSOFT GmbH\VisiWin\4.0\ServerComponents\MbProbe\"
|
|
|
|
|
wshshell.RegWrite strKey & "Run",strResult
|
|
|
|
|
Else
|
|
|
|
|
Call Fnct.SetIniString("run",strResult,"0",strVisuDir & "\Program\Visu2000.vwi")
|
|
|
|
|
Call Fnct.SetIniString("run","VW_MbDiag.VW_MbDiag.1","0",strVisuDir & "\Program\Visu2000.vwi")
|
|
|
|
|
On Error Resume Next
|
|
|
|
|
strKey = "HKEY_LOCAL_MACHINE\SOFTWARE\INOSOFT GmbH\VisiWin\4.0\ServerComponents\MbProbe\Run"
|
|
|
|
|
wshshell.RegDelete strKey
|
|
|
|
|
Err.Clear
|
|
|
|
|
On Error Goto 0
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Call wshShell.Run("""" & strVisuDir & "\Program\Tools\RegisterVisu2000.bat""",1,True)
|
|
|
|
|
Call wshShell.Run("""" & strVisuDir & "\Program\Tools\Visu2000Configuration.exe""" & strVisuDir & " 0 1",1,True)
|
|
|
|
|
if(fso.FileExists(strVisuDir & "\Program\visu2000.vws")) Then
|
|
|
|
|
Call wshShell.Run("""" & strVisuDir & "\Program\Tools\Visu2000Database.exe""" & strVisuDir & "\Program\visu2000.vws " & strVisuDir & " 1",1,True)
|
|
|
|
|
else
|
|
|
|
|
Call wshShell.Run("""" & strVisuDir & "\Program\Tools\Visu2000Database.exe""" & strVisuDir & "\Program\visu2000.dxt " & strVisuDir & " 1",1,True)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If fso.FileExists(strVisiwinDir & "\idxeditor.exe") Then
|
|
|
|
|
Call wshshell.Run("""c:\SaveAndRestore\Warning.vbs""")
|
|
|
|
|
WScript.Sleep(1000)
|
|
|
|
|
Call wshShell.Run("""" & strVisiwinDir & "\idxeditor""" & strVisuDir & "\Program\Visu2000.mdb")
|
|
|
|
|
wscript.sleep 10000
|
|
|
|
|
wshshell.sendkeys "%{F4}"
|
|
|
|
|
wscript.sleep 1000
|
|
|
|
|
wshshell.SendKeys("%{F4}")
|
|
|
|
|
wscript.sleep 1000
|
|
|
|
|
wshshell.AppActivate("Busy!")
|
|
|
|
|
wshshell.SendKeys("%{F4}")
|
|
|
|
|
WScript.Sleep(1000)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Call FirewallSettings()
|
|
|
|
|
|
|
|
|
|
' Autostarteintrag f. TWinCAT
|
|
|
|
|
Dim strPrograms
|
|
|
|
|
Dim scut
|
|
|
|
|
strPrograms=wshshell.SpecialFolders(2)
|
|
|
|
|
set scut = wshshell.CreateShortcut(strPrograms & "\TwinCAT System\StartUp\Operator System.lnk")
|
|
|
|
|
scut.TargetPath = strVisuDir & "\Program\Tools\StartDelay.exe"
|
|
|
|
|
scut.Arguments = ""
|
|
|
|
|
scut.Save
|
|
|
|
|
'------------------------------- Funktionen ------------------------------------
|
|
|
|
|
Function GetCurrentPath()
|
|
|
|
|
Dim l_strScriptName
|
|
|
|
|
Dim l_strTemp
|
|
|
|
|
|
|
|
|
|
l_strScriptName = WScript.ScriptFullName
|
|
|
|
|
l_strTemp = WScript.ScriptName
|
|
|
|
|
GetCurrentPath = Left(l_strScriptName, Len(l_strScriptName) - Len(l_strTemp))
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
Function ExpandPath(p_strEnvironment,p_strDefault)
|
|
|
|
|
Dim l_strTemp
|
|
|
|
|
l_strTemp = wshshell.ExpandEnvironmentStrings(p_strEnvironment)
|
|
|
|
|
If l_strTemp = p_strEnvironment Then
|
|
|
|
|
l_strTemp = p_strDefault
|
|
|
|
|
End If
|
|
|
|
|
ExpandPath = l_strTemp
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
'-------------------------------- Subs ------------------------------------------
|
|
|
|
|
' Einstellungen f<>r die Firewall
|
|
|
|
|
Sub FirewallSettings
|
|
|
|
|
Dim l_bFirewallExists, l_bLineDisplayExists,l_bFRCHostExists
|
|
|
|
|
Dim strFockeTools
|
|
|
|
|
strFockeTools = ExpandPath("%FOCKETOOLSDIR%","C:\FockeTools")
|
|
|
|
|
|
|
|
|
|
l_bFirewallExists = fso.FileExists(strFockeTools & "\fwprgadd.bat")
|
|
|
|
|
'Liniendisplay
|
|
|
|
|
l_bLineDisplayExists = fso.FileExists(strVisuDir + "\Program\LineDisplay\LineDisplay.exe")
|
|
|
|
|
If l_bFirewallExists And l_bLineDisplayExists Then
|
|
|
|
|
Call wshshell.Run(strFockeTools & "\fwprgadd.bat " + strVisuDir + "\Program\LineDisplay\LineDisplay.exe ""LineDisplay""",1,True)
|
|
|
|
|
End If
|
|
|
|
|
'FockeRemoteHost
|
|
|
|
|
l_bFRCHostExists = fso.FileExists(strVisuDir + "\Program\LineDisplay\FRCHost.exe")
|
|
|
|
|
If l_bFirewallExists And l_bFRCHostExists Then
|
|
|
|
|
Call wshshell.Run(strFockeTools & "\fwprgadd.bat " + strVisuDir + "\Program\LineDisplay\FRCHost.exe ""FRCHost""",1,True)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|