Automation Objects Programmer's Guide

From ER/Studio Data Architect
Jump to: navigation, search

Go Up to Automating ER/Studio Data Architect

This section details specific coding tasks common to ER/Studio Data Architect macros. There are a few, but critical, syntactic differences from other BASIC languages.

This is intended for programmers with a working knowledge of BASIC. You can learn it using ER/Studio Data Architect's macro editor, but you will also need a textbook devoted specifically to beginner BASIC programmers.

Note on Properties Get/Let

A property can be defined as Get/Let, meaning you can read the property (Get) or change it (Let). However, many such properties are set by ER/Studio Data Architect and are in fact read-only, that is Get but not Let. For example, most of the numeric IDs are Get-only.

In general, if you can edit a property using ER/Studio Data Architect's GUI design controls, and there exists an automation object for it, it will exist as Get/Let. If you can't edit it in ER/Studio Data Architect, it's read-only (Get -only).

Note on Use of "Set"

The code samples do not always use "Set." In the SAX BASIC Editor within ER/Studio Data Architect, you must use the function Set on the first instance of the object in a script (or block of code within object scope). You must use it again if the object reference changes. This is distinct from coding for BASIC executable images where you can declare objects Public (etc.) and not have to Set them, as in Microsoft's VB.Net.

An ER/Studio Data Architect Macro Editor Example:

Set MyDiagram = DiagramManager.ActiveDiagram

'some code that closes the active diagram and opens another diagram

Set MyDiagram = DiagramManager.ActiveDiagram

Note on Dim [what] As [ever]

SAX BASIC will not allow you to declare and initialize any variable in one statement. Example:

'No way:

Dim MyData As Integer = 30

'This is OK:

Dim MyData As Integer

MyData = 30

Related Topics

Object Model Hierarchy Diagram

Instantiating the Parent Object in the Macro Editor

Instantiating the Parent Object in an External Application

Accessing Collections of Objects

Assigning Object Appearance and Behavior Using Properties

Performing Complex Actions Using Methods

Sample Macros Installed with ER/Studio Data Architect

Running ER/Studio Data Architect Macros from Windows

Creating Event Handlers

Handling Update Events

Adding Macros to GUI Modeling Menus

Automating ER/Studio Data Architect

See Also