Using the SAX Basic Macro Editor

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

Go Up to Automating ER/Studio Data Architect

You can write and execute automation scripts using the Macro Editor (WinWrap). The ER/Studio Data Architect Macro language consists of the WINWRAP BASIC language (formerly SAX Basic) extended with ER/Studio Data Architect object types. WINWRAP 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.

Notepad blue icon 2.pngNote: You can have a maximum of nine macro editor instances open at one time.

Code Auto-Completion

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:

ED MACRO CONTEXT SENSITIVE.gif

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.

DB MACRO EDITOR ACTIVEX AUTOMATION MEMBERS.gif

For more information about the ActiveX Automation Members Browser, see the WinWrap Basic Help.

Add, Edit, and Run BASIC Macros

ER/Studio Data Architect contains a WINWRAP BASIC editor, interpreter and debugger ("editor" hereafter).

To use the WinWrap BASIC editor

On the Data Model Explorer, click the Macros tab.

  • For more information on the WINWRAP BASIC language, click the editor's Help button.

Add a Macro

  1. On the Data Model Explorer, select the Macros tab.
  2. Right-click a macro or macro folder, and select Add Macro to open the Macro editor.
  3. 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

  1. Right-click the macro and select Rename Macro.
  2. Edit the macro name, or type in a new name.
  3. Press Enter to save the new name.

Notepad blue icon 2.pngNote: You may need to refresh the file list to see it displayed.

Delete a Macro

If you no longer need a macro, you can delete it. To delete a macro, do the following:

  1. Right-click the macro you want to delete and then select Delete Macro.
  2. 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.

Magic Wand Icon.pngTip: To run a macro from within the ER/Studio Data Architect Basic Macro Editor, click Start or click the green arrow button.

See Also