Hi,
I get Error E429, ActiveX Object Cannot be created when running the following script on a TP700 panel:
Any help would be great,
Thanks,
Combo
I get Error E429, ActiveX Object Cannot be created when running the following script on a TP700 panel:
Code:
Sub Logging()
Dim fs, f, DataSet, Dataformat, file_path, file_name, file_name_path, Str1, Str2, Str3, Str4, Str5, y, m, d
y = Year(Now)
m = Month(Now)
d = Day(Now)
If Call_Script = True Then
Delay(5) '5 seconds delay
On Error Resume Next
Set fs = CreateObject("filectl.filesystem")
Set f = CreateObject("filectl.file")
If Eventdata_Gestart Then
Str1 = "Machine Gestart"
Else
Str1 = "Machine Gestopt"
End If
If Eventdata_Alarmbit Then
Str2 = "Alarm Actief"
Else
Str2 = ""
End If
If Eventdata_Deuren Then
Str3 = "Deur Open"
Else
Str3 = ""
End If
If Eventdata_Reset Then
Str4 = "Machine Reset Bezig"
Else
Str4 = ""
End If
If Eventdata_Keuze_Recept Then
Str5 = "Nieuw Recept gekozen"
Runnr = Runnr + 1
Else
Str5 = ""
End If
file_path = "C:\Server\Logging\"
file_name = CStr(y) & "_" & CStr(m) & "_" & CStr(d) & "_" & "_Recnr" & ".csv"
file_name_path = file_path & file_name
Dataformat = ("Datum" & ";" & "Tijd" & ";" & "Machine Gestart" & ";" & "Alarm" & ";" & "Deuren" & ";" & "Reset" & ";" & "Receptwijziging" & ";" & "Naam" & ";" & "Teller" & ";" & "Profieltijd (min)" & ";" & "Stuktijd (s)")
DataSet = (Date & ";" & Time & ";" & Str1 & ";" & Str2 & ";" & Str3 & ";" & Str4 & ";" & ACTIEF_PRODNAME & Productieteller & ";" & cyclustijdprofiel & ";" & Cyclustijdstuk)
If Err.Number <> 0 Then
ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
Err.Clear
Exit Sub
End If
If fs.dir(file_name_path)="" Then
f.open file_name_path, 2 'Construct
f.LinePrint Dataformat
f.Lineprint DataSet
f.close
Else
f.open file_name_path, 8 'Append
f.Lineprint DataSet
f.close
End If
If Err.Number <> 0 Then
ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
Err.Clear
Exit Sub
End If
Set f = Nothing
Set fs = Nothing
Call_Script = 0
ShowSystemAlarm "Historian storage was successful"
End If
End Sub
Any help would be great,
Thanks,
Combo