AnsweredAssumed Answered

Processbook Filesystem Objects VBA Question

Question asked by jasenswalley on Apr 2, 2015
Latest reply on Apr 3, 2015 by jasenswalley

How do we manipulate filesystem objects using the VBA that is included with ProcessBook?


What I am trying to accomplish is read a text file and assign a variable to each tag listed in the file.


For example a text file that reads:






I want to loop through each of them and do something like this:


Private Sub Display_Open()

Dim filename as string = "C:\taglist.txt";

Dim Tagname as string

//forgive me but I'm dropping into some C# code because that's what I know

foreach(string line in lines)


                    sdk = new PISDK.PISDKClass();

                    sdkobject = new PISDKDlg.ApplicationObject();

                    PISDK.Server server;

                    PISDK.PIPoints points;

                    PISDK.PIPoint snapshotpoints;

                    PISDK.PIValue values;

                    server = sdk.Servers["mypiserver"];



                    points = server.PIPoints;

                    snapshotpoint = points[line];

                    snapshotvalue = snapshotpoint.Data.Snapshot;

                    timestamp = values.TimeStamp.LocalDate.ToString();



/end C# code



End Sub


What that routine does is loop through a text file and for each tag listed and gets the snapshot value of each point.  What I want to do with this one is do something with the variable of Tagname and assign each line as the variable.


So when opening the Processbook display it will do a Trend1.AddTrace(TagName) with each of the tags listed in the text file.


I can probably get it if someone knows how to open a text file with VBA in Processbook.