Before You Begin

A script communicates with its host and other applications through a COM technology called Automation (formerly OLE Automation). To support automation, an application requires an object model that exposes certain objects, with their properties and methods, to external applications. The automation client can do anything which is supported by the automation server, including the extraction of information from the server, as well as object and property manipulation.

In this model the schematic application is the server, and the scripts and forms that you build are the clients. The relationship is conceptually illustrated in Figure 1.

Figure 1. Server-client relationship in scripting

With automation, the schematic application and its components become objects you can control programmatically. In addition to manipulating objects exposed by the scripting host, a script can also manipulate objects served by other automation servers. For example, a script in the schematic application can manipulate an Excel spreadsheet or a Word document. The reverse of this is also possible: a Word or Excel script can manipulate the schematic document.

In order to create effective script, it is necessary to understand the elements available for manipulation with scripting. These are objects, properties, methods, and events.

Objects are elements within an application that can be examined or manipulated by scripts, while properties are descriptive data that define the object with which they are associated. For example, a data model in Xpedition Designer might include the objects show in Figure 2.

Figure 2. An Example Data Model

Methods are operations that can be performed on an object. For example, methods can include closing or saving a document, or setting or retrieving values from an object. Events are actions that occur within the application for which a script is written to respond. For example, a script may be triggered before or after a project document is opened or saved.