SOLVED!!
Does anyone know how to let homeseer read a csv file from C:/ ?
regards
Does anyone know how to let homeseer read a csv file from C:/ ?
regards
If this is your first visit, be sure to check out the FAQ. You must register before you can post.
IMPORTANT: Your first post will be checked for appropriate content. This may take a bit of time.
23/08/2017,02:44,"PT-FK-41","PT-FK-41.jpg"
Dim str As String Dim FileName As string = path Dim SplitStr() As String str = My.Computer.FileSystem.ReadAllText(FileName) SplitStr = Split(str, ",") hs.writelog("0", SplitStr(0)) 'Date Ref = hs.GetDeviceRef("ANPR-Date") hs.SetDeviceString(ref, SplitStr(0), True) hs.writelog("1", SplitStr(1)) 'Time Ref = hs.GetDeviceRef("ANPR-Time") hs.SetDeviceString(ref, SplitStr(1), True) hs.writelog("2", SplitStr(2)) 'Plates Ref = hs.GetDeviceRef("ANPR-Plates") hs.SetDeviceString(ref, SplitStr(2), True)
Sub Main(ByVal Parms As Object) Dim str As String Dim FileName As string = path Dim SplitStr() As String str = My.Computer.FileSystem.ReadAllText ("C:/test.csv") SplitStr = Split(str, ",") hs.writelog("0", SplitStr(0)) 'Date hs.writelog("1", SplitStr(1)) 'Time hs.writelog("2", SplitStr(2)) 'Plates End Sub
Aug-28 13:38:06 2 "PT-FK-41" Aug-28 13:38:06 1 20:44 Aug-28 13:38:06 0 23/08/2016
23/08/2016,20:44,"PT-FK-41","PT-FK-41.jpg" 23/08/2017,02:44,"PT-FK-41","PT-FK-42.jpg"
Sub Main(ByVal Parms As Object) Dim fso, file, filename, data, r, cmd, path, arrSplitData Path = "C:\test.csv" fso = CreateObject("Scripting.FileSystemObject") file = fso.OpenTextFile(Path, 1, True) do while file.AtEndOfStream <> True r = file.ReadLine arrSplitData = split(r,",") hs.writelog("0", arrSplitData(0)) hs.writelog("0", arrSplitData(1)) hs.writelog("0", arrSplitData(2)) Loop file.Close end sub
hs.writelog("0", arrSplitData(0)) hs.writelog("0", arrSplitData(1)) hs.writelog("0", arrSplitData(2))
Comment