Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Description : Exporta dados correntes do GE iFix database (pdb)
- ' Author : intech@intech-automacao.com.br
- ' Date : 2019.09.13
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Option Explicit
- Sub ExportIfixCurrentPdbData()
- Dim arr As Variant
- Dim fds As Object
- Dim i As Integer
- Dim oDataGroup As Object
- Dim regex As Object
- Dim sFilePath As String
- Dim sFolder As String
- Dim sNodeName As String
- Dim sReadLine As String
- Dim tag As Variant
- ' Inicializa arr como Array
- arr = Array()
- Set fds = CreateObject("FixDataSystems.Intellution FD Data System Control")
- ' Regular expression ignora cabecalho, comentario e linhas vazias.
- Set regex = CreateObject("VBScript.RegExp")
- regex.Pattern = "^(\[|\!)|^$"
- ' Pasta %temp%
- sFolder = Environ("temp")
- sFilePath = sFolder & "\MyPDB.csv "
- ' Exporta PDB para %temp%
- Shell "dbexporter /n" & System.MyNodeName & " /o" & sFilePath & "/r"
- Open sFilePath For Input As #1
- Do Until EOF(1)
- Line Input #1, sReadLine
- If Not regex.Test(sReadLine) Then
- ReDim Preserve arr(UBound(arr) + 1)
- arr(UBound(arr)) = Replace(Split(sReadLine, ";")(1), """", "")
- End If
- Loop
- Close #1
- Set oDataGroup = fds.Groups.Add("DataGroup")
- ' sNodeName = "fix32." & ""
- sNodeName = "fix32." & System.MyNodeName & "."
- For Each tag In arr
- oDataGroup.DataItems.Add sNodeName & tag & ".f_cv"
- Next
- oDataGroup.Read
- For i = 1 To oDataGroup.DataItems.Count
- Debug.Print arr(i - 1), oDataGroup.DataItems.Item(i).Value
- Next
- End Sub
Add Comment
Please, Sign In to add comment