To run a macro in the Scripting Editor, right-click the macro in the Scripting Project tree and select the command Run Macro.
There are different ways to run a macro from UModel:
|•||Via the Tools | Macros menu of UModel.|
|•||By creating and using a toolbar button for a macro.|
Note that only one macro can be run at a time. After a macro (or event) is executed, the script is closed and global variables lose their values.
The Tools | Macros menu command (screenshot below) opens a submenu containing the macros defined in the Scripting Project that is currently active in UModel. The active Scripting Projects are specified in the Scripting tab of the Options dialog, or in the Scripting tab of the project settings.
From the submenu of available macros, select the macro to run. The macro will be executed.
You can create an icon in the toolbar or a menu item that runs a selected macro. To do this, click Tools | Customize | Macros. This causes the Customize dialog to be displayed (screenshot below).
Now do the following:
|1.||In the Macros tab of the Customize dialog, select the required macro from the Macros pane. The macros in the Macros pane are those in the active Scripting Project (which is specified in the Scripting tab of the Options dialog).|
|2.||In the Display Text input field enter the name of the icon. This name will appear when the cursor is placed over the icon when it is in the toolbar.|
|3.||Click Add Command to add it to the list of commands.|
|4.||Select the command and click Edit Icon to create a new icon.|
|5.||Drag the finished icon from the Associated Commands pane and drop it on to the toolbar or menu when the cursor changes from an arrow to an I-beam or line.|
|6.||Macros can even be assigned their own shortcuts in the Keyboard tab of the Customize dialog (see screenshot above).|
To remove the toolbar icon, open the Macros tab of the Customize dialog and drag the icon out of the toolbar and into the Associated Commands pane. Select the command in the Associated Commands pane and click Remove to remove the command from the pane.
© 2019 Altova GmbH