<< Click to Display Table of Contents >>
Global Functions |
In addition to pre-defined VBScript functions, such as CreateObject, Chr, CLng, and Replace, among others, this Driver defines the global functions described on the next table.
Global functions
Function |
Description |
---|---|
NewValue(Value, Quality, TimeStamp) |
Creates a Value-type object (Value Object), which contains a value, a quality, and a timestamp. The Quality and TimeStamp parameters are optional and, if not specified, assume the values 192 and Now(), respectively |
Trace(String) |
Writes a message to this Driver's log file |
CreateDotNetObject(String, String) |
Creates a .NET-type object. The first parameter corresponds to the full path of a .NET assembly and the second parameter refers to the name available in the assembly, including its Namespace, separated by a dot, such as "Namespace.Class". The return of this function is the object created. NOTE: The .NET assembly created must be configured to communicate via COM interface, that is, with the COM-Visible option enabled. The CreateDotNetObject function supports assemblies compiled using .NET framework version 3.5 or earlier |
The next code contains an example of using global functions.
Dim obj
Sub OnStart()
Set obj = CreateDotNetObject("C:\MyAssembly.dll",_
"MyNamespace.MyClass")
obj.MyClassMethod()
End Sub
Sub OnRead_List(r, v)
v.DimAsList()
Dim tStamp
tStamp = Now() - 2 ' the day before yesterday
Trace "Returning a list of values"
v.AddToList(NewValue("yesterday", 192, Now() - 1))
v.AddToList(NewValue("today"))
v.AddToList(NewValue("tomorrow", 192, Now() + 1))
End Sub
Sub OnStop()
Set obj = Nothing
End Sub