Using the SAX Basic Macro Editor
You can write and execute automation scripts using the Macro Editor (WinWrap). The ER/Studio Data Architect Macro language consists of the SAX BASIC language extended with ER/Studio Data Architect object types. SAX BASIC is very similar to Visual Basic but there are some differences, so be sure to note the differences described in the Automation Interface Reference.
To launch the Basic Macro Editor, choose Tools > Basic Macro Editor.
You can save time typing code using the context-sensitive editing assistant. Use the short cut menus and pop-up menus to help you write macros. When you start the Macro Editor, a reference to the ER/Studio Data Architect library is automatically set and then you can use the menus to complete regular expressions and so on. The Editor offers the menus and pop-ups while you write your code. Where a choice must be made, the Editor either gives you a list of choices or the necessary syntax.
The scrolling menus let you select from the available objects or properties and methods. As an example:
ActiveX Automation Members Browser (OLE Viewer)
The ActiveX Automation Members Browser displays the ER/Studio Data Architect Type Library automation objects. You can copy and paste function templates into your scripts.
To browse through the objects, select an object from the Data Type list. This menu lists all automation objects used specifically in ER/Studio Data Architect, along with several Visual Basic objects denoted by Vb<DataType>. The Methods/Properties list box is populated with methods and properties specific to the selected object. When you select one of the methods or properties, other information appears in the dialog box.
The Browser lets you paste a function into your macro. You can also follow the result before pasting the function. Following the result adds other parameters to the function. The help string describes the selected property or method. This is the same information used by other typelib viewers, such as Microsoft's Visual Studio OLE Viewer or typelib utilities in any code editor.
Click the ? button to open the Automation Interface Reference for the object to give more detailed information about its property or method.
For more information about the ActiveX Automation Members Browser, see the Sax Basic Help.
Add, Edit, and Run BASIC Macros
ER/Studio Data Architect contains a SAX BASIC editor, interpreter and debugger ("editor" hereafter).
To use the SAX BASIC editor
On the Data Model Explorer, click the Macros tab.
- For more information on the SAX BASIC language, click the editor's Help button.
Add a Macro
- On the Data Model Explorer, select the Macros tab.
- Right-click a macro or macro folder, and select Add Macro to open the Macro editor.
- You may need to refresh the file list to see it displayed after you have saved it.
Edit a Macro
To edit a macro, double-click it.
Rename a Macro
- Right-click the macro and select Rename Macro.
- Edit the macro name, or type in a new name.
- Press Enter to save the new name.
Delete a Macro
If you no longer need a macro, you can delete it. To delete a macro, do the following:
- Right-click the macro you want to delete and then select Delete Macro.
- Click Yes.
Run a Macro
Once you have created and saved a macro, you can run the macro.
Right-click the macro and then select Run Macro.