Industry Online Support
Technical Forum
1/14/2015 6:03 AM | |
Posts: 22 Rating: (1) |
Dear Captive Engineer, I am also facing thisError #429 ActiveX Component can’t create object”error , while using Panel Base VB Script in ES project , So can you please guide me to run this script on ES. Read_Data :- 'Tip: ' 1. Use the <CTRL+SPACE> or <CTRL+I> keystroke to open a list of all objects and functions ' 2. Write the code using the HMIRuntime object. ' Example: HmiRuntime.Screens("Screen_1"). ' 3. Use the <CTRL+J> keystroke to create an object reference. 'Write the code as of this position: 'Declaration of local tags - Deklaration der lokalen Variablen Dim fo Dim path Dim mode Dim delimiter Dim data Dim splitdata 'Initialization of Tags - Initialisierung von Variablen mode=1 '1 = Input 'Selection of the storage path - Auswahl des Speicherpfads If SmartTags("bExtension") =0 Then path ="\Storage Card SD\datafile.txt" delimiter=vbTab Else path ="\Storage Card SD\datafile.csv" delimiter=";" End If 'Starting error routine - Starten der Fehlerroutine On Error Resume Next 'Create a file object - Datei Objekt erstellen Set fo= CreateObject("FileCtl.File") 'Check if any errors happend - Auf Fehler prüfen If Err.Number<> 0 Then ShowSystemAlarm "Error # " & CStr(Err.Number)& " "& Err.Description Err.Clear Exit Sub End If 'Open or creat a file - Öffnen bzw. Erstellen einer Datei fo.open path,mode 'Check if any errors happend - Auf Fehler prüfen If Err.Number<> 0 Then ShowSystemAlarm "Error # " & CStr(Err.Number)& " "& Err.Description Err.Clear Exit Sub End If 'Read data from file - Daten werden aus Datein gelesen While fo.EOF = False data=fo.LineInputString Wend 'Write data to HMI-Tags - Daten werden auf die HMI-Variablen geschrieben data=Replace(data,vbTab & vbTab,delimiter) splitdata=Split(data,delimiter) SmartTags("szDate")=splitdata(0) SmartTags("szString_1")= splitdata(1) SmartTags("iValue_1")=splitdata(2) SmartTags("iValue_2")=splitdata(3) 'Close the file - Datei wird geschlossen fo.Close 'Release the Object - Objekt wird freigegeben Set fo = Nothing ShowSystemAlarm "Reading of data was successful!" End Sub ------------------------------------------------------------------------------------------------------ Write_Data :- Sub Write_data() 'Tip: ' 1. Use the <CTRL+SPACE> or <CTRL+I> keystroke to open a list of all objects and functions ' 2. Write the code using the HMIRuntime object. ' Example: HmiRuntime.Screens("Screen_1"). ' 3. Use the <CTRL+J> keystroke to create an object reference. 'Write the code as of this position: 'Declaration of local tags - Deklaration der lokalen Variablen Dim fo Dim path Dim mode Dim delimiter Dim gap Const NEU=0 'Initialization of Tags - Initialisierung von Variablen mode=8 '8 = Append 'Selection of the storage path - Auswahl des Speicherpfads If SmartTags("bExtension") =0 Then path ="\Storage Card SD\datafile.txt" delimiter=vbTab gap=vbTab Else path ="\Storage Card SD\datafile.csv" delimiter=";" gap="" End If 'Starting error routine - Starten der Fehlerroutine On Error Resume Next 'Create a file object - Datei Objekt erstellen Set fo= CreateObject("FileCtl.File") 'Check if any errors happend - Auf Fehler prüfen If Err.Number<> 0 Then ShowSystemAlarm "Error # " & CStr(Err.Number)& " "& Err.Description Err.Clear Exit Sub End If 'Open or create a file - Öffnen bzw. Erstellen einer Datei fo.open path,mode 'Check if any errors happend - Auf Fehler prüfen If Err.Number<> 0 Then ShowSystemAlarm "Error # " & CStr(Err.Number)& " "& Err.Description Err.Clear Exit Sub End If 'Write Headline if File is new - Erstellen einer Kopfzeile bei neuen Dateien If fo.LOF = NEU Then fo.LinePrint("Date" & gap & gap & delimiter & "Material" & delimiter & "Presure" & delimiter & "Temperature" & delimiter) End If 'Write data into file - Daten werden in die Datein geschrieben fo.LinePrint(Now & delimiter & SmartTags("szMaterial") & gap & delimiter & SmartTags("iPressure") & delimiter & SmartTags("iTemperature") & delimiter) 'Close the file - Datei wird geschlossen fo.Close 'Release the Object - Objekt wird freigegeben Set fo = Nothing ShowSystemAlarm "Storage of data was successful!" End Sub
AttachmentScript.zip (134 Downloads) |
1/14/2015 10:36 AM | |
Joined: 9/3/2014 Last visit: 3/13/2019 Posts: 4766 Rating: (122) |
|
Follow us on