Example Scripting Project
A demo project that illustrates scripting with UModel is available at the following path: C:\Users\<user>\Documents\Altova\UModel2024\UModelExamples\Scripting\ScriptSampleFind.asprj.
This scripting project consists of a macro and a Windows form. The form is where you can search for UML packages, interfaces, operations, and other element kinds in the currently opened UModel project. You can choose the element kinds to be searched for, and you can also make the search case insensitive, and match whole words only.
To load the scripting project into Scripting Editor:
1.On the Tools menu, click Scripting Editor.
2.Click Open and browse for the ScriptSampleFind.asprj file from the path above.
Notice that the project contains a macro called Find Sample in the "Macros" directory. Also, a search form is available in the "Forms" directory, and it includes various form event handlers.
To enable the scripting project as global UModel scripting project:
1.On the Tools menu, click Options.
2.Click the Scripting tab.
3.Under "Global scripting project file", click Browse and select the ScriptSampleFind.asprj file from the path above.
4.This scripting project does not have auto-macros and application event handlers; therefore, you don't need to select either the Run auto-macros... or Process events check boxes.
5.Click Apply.
At this stage, a new menu item called Find Sample becomes available under the Tools | Macros menu. This new menu item calls the macro of the scripting project.
To run the macro:
1.Open a UModel project that contains several packages, operations, and so on (in this example, C:\Users\<user>\Documents\Altova\UModel2024\UModelExamples\Bank_Java.ump).
2.On the Tools menu, click Macros, and then click Find Sample.
3.Type the search term, and click Find.
As shown above, all project elements whose name contains the search term are now listed. You can click on any element in the grid to select it in the Project window.