Update cookies preferences

GetObject - function of language VBScript

Returns the Automation object from the file.
Object GetObject([String Path], [String Class])
Path[optional] (String) Full path and file name containing the object to retrieve.
If not set, then the Class parameter is required.
Class[optional] (String) Class of the object.
The application name providing the object class of object to create.
Use the GetObject function to access an Automation object from the file and assign the object to an object variable. Use the Set statement to assign the object returned by GetObject to the object variable.
Select and copy to clipboard

Dim CADObject
Set CADObject = GetObject("C:\CAD\SCHEMA.CAD")

When this script is executed, the application associated with the specified pathname is started and the object in the specified file is activated.
If the Path parameter is a empty string (""), then GetObject returns a new object instance of the specified type.
If the Path parameter is omitted, then function returns a currently active object of the specified type.
If object of the specified type does not exist, then an error occurs.
Some applications allow you to activate part of a file. Add an exclamation point (!) to the end of the file name and follow it with a string that identifies the part of the file you want to activate. For information on how to create this string, see the documentation for the application that created the object.
For example, in a drawing application you might have multiple layers to a drawing stored in the file. You could use the following script to activate a layer within a drawing named "SCHEMA.CAD":
Select and copy to clipboard

Dim LayerObject
Set LayerObject = GetObject("C:\CAD\SCHEMA.CAD!Layer3")

If you don't specify the object's class, then Automation determines the application to start and the object to activate, based on the file name you provide. Some files, however, may support more than one object class. For example, a drawing might support three different types of objects: an Application object, a Drawing object, and a Toolbar object, all of which are part of the same file. To specify which object in the file you want to activate, use the optional Class parameter.
Select and copy to clipboard

Dim oObject

In the preceding example, FIGMENT is the name of a drawing application and DRAWING is one of the object types it supports. Once an object is activated, you reference it in the script using the object variable you defined. In the preceding example, you access properties and methods of the new object using the object variable oObject.
Select and copy to clipboard

oObject.Line 9, 90
oObject.InsertText 9, 100, "Hello, world."

Use the function if there is a current instance of the object or if you want to create the object with a file already loaded. If there is no current instance, and you don't want the object started with a file loaded, then the CreateObject function can be used.
If an object has registered itself as a single-instance object, then only one instance of the object is created, no matter how many times CreateObject function is executed. With a single-instance object, GetObject always returns the same instance if is called with the empty string ("") syntax, and it causes an error if the Path parameter is omitted.
See also:
- Pm.ShellExecute (method)
- Pm.CreateProcess (method)
The example shows how to read value from other PROMOTIC application. Every PROMOTIC application is an object from the Windows OS point of view. By the GetObject method, can be obtained another PROMOTIC application (C:\Proj2\Proj2.pra) on the same computer. From this application can be obtained the value the "Temperature" variable in the /Data object.
Select and copy to clipboard

Dim oProj, oPm, Val
Set oProj = GetObject("C:\proj2\proj2.pra")
If Not oProj Is Nothing Then
Set oPm = oProj.Application.Pm
Val = oPm("/Data").Item("Temperature").Value
End If
PROMOTIC 9.0.28 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.