You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.8 KiB
Plaintext

'-------------------------------------------------------------------------------
' (C) Focke & Co
' Date:
' Author: cbr
'-------------------------------------------------------------------------------
Option Explicit
Dim wshshell,fso,i,Fnct
Dim strPath,strSystemFolder,strWinFolder,strTempFolder
'----------------------------- Objekte erzeugen --------------------------------
Dim strCurrentObject
i = 0
On Error Resume Next
Do
err.Clear
i = i+1
strCurrentObject = "WScript.Shell"
Set wshshell = CreateObject("WScript.Shell")
strCurrentObject = "Scripting.FileSystemObject"
Set fso = CreateObject("Scripting.FileSystemObject")
strCurrentObject = "Install.Functions"
Set Fnct = CreateObject("Install.Functions")
WScript.Sleep 1000
Loop Until Err.Number = 0 OR i > 30
If Err.Number <> 0 Then
MsgBox "Unable to Create Object: " & strCurrentObject
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 strVal1,strVal2
strVal1 = "nimdAekcoF"
strVal2 = "inimeG!"
Dim strFockeTools,strMainVolume,strComputerIni
strFockeTools = ExpandPath("%FOCKETOOLSDIR%","C:\FockeTools") & "\"
strMainVolume = ExpandPath("%MAIN_VOLUME%","c:\")
strComputerIni = strMainVolume & "Computer.ini"
Call wshshell.Run(strFockeTools & "\IsAdmin.exe",1,True)
If Fnct.GetIniString("CurrentLogon","Administrator",strComputerIni) = "1" Then
Call wshshell.Run(GetTWinCATFolder() & ("\PLC\TCatPlcCtrl.exe"))
wscript.Quit
End If
strVal1 = StrReverse(strVal1)
strVal2 = StrReverse(strVal2)
Dim strCommandLine
strCommandLine = strPath & "vbrunas.vbs " & strVal1 & " " & strVal2 & _
" " & GetTWinCATFolder() & ("\PLC\TCatPlcCtrl.exe")
Call wshshell.run(strCommandLine)
'------------------------------- 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
Function GetTWinCATFolder
Dim l_strDir
l_strDir = wshshell.ExpandEnvironmentStrings("%TWINCATDIR%")
If l_strDir = "%TWINCATDIR%" Then l_strDir = "C:\TWinCAT"
GetTWinCATFolder = l_strDir
End Function
'------------------------------ Sub -------------------------------------------