Option Explicit Dim wshshell Dim fso 'Dim MachineType 'Dim MachineNumber Dim FileName Dim IpString Dim RtsCount Dim i Dim Fnct Dim Key,TmpKey set wshshell = CreateObject("WScript.Shell") Set Fnct = CreateObject("Install.Functions") GetInputs key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\System\SysAutoStart" wshshell.RegWrite key,0,"REG_DWORD" key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\System\SysStartupState" wshshell.RegWrite key,6,"REG_DWORD" key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcIo\Start" wshshell.RegWrite key,3,"REG_DWORD" key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcNc\Start" wshshell.RegWrite key,3,"REG_DWORD" key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcPlc\Start" wshshell.RegWrite key,3,"REG_DWORD" key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcRouter\Start" wshshell.RegWrite key,2,"REG_DWORD" key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcRTime\Start" wshshell.RegWrite key,3,"REG_DWORD" For i = 1 To RtsCount Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\System\build" If wshshell.RegRead(key) >= 718 Then Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\Plc\LoadBootPrjRetainData" & CStr(i) wshshell.RegWrite key,0,"REG_DWORD" Else Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\Init8\PLC: Load Boot Project\" TmpKey = Key + "Cmd" + CStr(i) wshshell.RegWrite TmpKey,20483,"REG_DWORD" TmpKey = Key + "Port" + CStr(i) wshshell.RegWrite TmpKey,801 + (i-1)*10,"REG_DWORD" TmpKey = Key + "Str" + CStr(i) wshshell.RegWrite TmpKey,0,"REG_BINARY" TmpKey = Key + "Msg" + CStr(i) wshshell.RegWrite TmpKey,"PLC Boot Project of Run-Time System " + CStr(i) + " loaded" End If Next Sub GetInputs Dim fso Dim CompFile IpString = "" Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists("c:\Computer.ini") Then IPString = Fnct.GetIniString("CD1_Setup", "TcpIp", "c:\Computer.ini") RtsCount = Fnct.GetIniString("CD1_Setup", "RtsCount", "c:\Computer.ini") End If If fso.FileExists("c:\Computer.txt") And IpString = "" Then Set CompFile = fso.OpenTextFile("c:\Computer.txt", 1) IPString = CompFile.ReadLine RtsCount = CompFile.ReadLine CompFile.Close End If end sub 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