Overview

What is Automation?

 

Automation (also known as OLE Automation) makes it possible for one application to manipulate objects implemented in another application, or to "expose" objects so they can be manipulated.

 

You can automate any object that exposes an automation interface, providing methods and properties that you can access from other applications. The automated object might be local or remote (on another machine accessible across a network).

 

Automation Clients and Servers

 

An Automation client is an application that can manipulate exposed objects belonging to another application. This is also called an Automation controller.

 

An Automation server is an application that exposes programmable objects to other applications. This is sometimes also called an “Automation component". These Automation objects have properties and methods as their external interface. Properties are named attributes of the Automation object. Properties are like the data members of a C++ class. Methods are functions that work on an Automation object. Methods are like the public member functions of a C++ class.

 

Automation in SapphireTrend

 

stPro and stTabular History both have Automation Interfaces and are therefore Automation Servers.

 

Why should I use it?

 

The automation interfaces for stPro and stTabular History can be used in situations where the Active-X controls are not appropriate.  

 

One such example would be where an operator wished to gain access to a trend of a set of OPC items without having to give up screen space for the OCX.  Since stPro is an Automation server it can be launched such that it executes independently of the launching process.

 

Examples

 

The following is an example of using the stPro Automation Interface from VBScript:

 

Set stPro = Wscript.CreateObject("STPro.Automation")

 

stPro.ConnectToCollector "BROOKEND"

stPro.NewPlotWindow "MyPlot","Misc"

stPro.AddPen "__SYSTEM__","5s.scantime",1,3

stPro.FetchData 1

 

Whilst the following is from VB.Net:

 

Module Module1

    Sub Main()

        '

        '   NB, remember to add a project reference to the stPro.tlb file (usually in C:\Program Files (x86)\Jemmac Software Ltd\Sapphire\bin)

        '

        Dim stPro As STProTypeLib.STProAutomation = New STProTypeLib.STProAutomation()

        stPro.ConnectToCollector("BROOKEND")

        stPro.NewPlotWindow("MyPlot", "Misc")

        stPro.AddPen("__SYSTEM__", "5s.scantime", 1, 3)

        stPro.FetchData(1)

    End Sub

End Module