Writing macros
Macros allow you to write your own algorithms on top of the data model used in the application. With full access to the data model, you can create, update, and run algorithms on objects including wells, logs, grids, properties, and surfaces. You can write, edit and run macros within JewelSuite 2026.1 Subsurface Modeling using Visual Basic or C# with full access to the .NET Framework and in an editor similar to Visual Studio. This makes your macros highly re-usable and portable, so you can conveniently share functions between team members and colleagues.
You can use methods from a wide range of assemblies, covering those with JewelSuite 2026.1 Subsurface Modeling and those included with Microsoft Windows™. You can also add methods contained in other assemblies. See Managing settings for macros for details.
Using macros with the Script Editor
To start working with macros, open the Script Explorer (Panes > Script Explorer in the Workspace section on the right of the Strip). In the Script Explorer, you can manage all your macros - create, import, export, rename and remove them - and also use it to manage your macro libraries and macro modules.
The Script Explorer gives you a hierarchical tree view of your libraries, modules and macros. At the top level, it holds all your libraries. One level down, the libraries contain modules. At the third level, each module contains macros.
Creating, importing, exporting and deleting libraries, modules and macros
You can create, import, export and delete libraries, modules and macros by right clicking on an item in the Script Explorer. You can also rename them by doubleclicking on an item and entering the new name.
To create a new library or macro
To create a new library or macro, right click anywhere in the Script Explorer and select Macro > Add Library or Add Macro (adding a macro to the Script Explorer creates a new macro inside a new module inside a new library).
To import a library or macro
Rather than create a new library or module, select Import Library, Import Module or Import Macro and select a file to import a library or macro that you or someone else has previously exported. You can also import a module, which may contain multiple macros, by selecting Import Module.
To add a new module or macro to the library
To add a new module or macro to the library, right-click on a library, and select Add Module or Add Macro from the context menu (adding a macro to the library creates a new macro inside a new module) . Select Import Module to import a previously exported module.
To export a library, module, or macro
You can also select Export Library to export the library and its contents as a joaMacroLib file for use by others or in other solutions. Right-click on a macro in the Script Explorer and select Export Macro to export it as a joaMacro file for use in other solutions.
To remove a library, module, or macro
To remove a library, including all its contents, from the Script Explorer, open the context menu and select Delete. To remove a module, including all its contents, open the context menu of the module and select Delete. To remove a macro, open the context menu of the macro and select Delete.
Using the Macro Editor
When you have created a macro, you edit it by right-clicking on it from the Script Explorer and selecting Edit Macro from the context menu. The Macro Editor then appears in your viewing area and displays the code of your macro. You can open multiple macros at the same time, perhaps to compare or copy code between them. Each will appear in its own tab in the Macro Editor.
The Macro Editor is a powerful code editor. It automatically colors your text to indicate comments, keywords etc. and, by right-clicking in the editor you can insert code snippets, and comment and uncomment lines and as well as cut, copy and paste.
Saving, compiling and running macros
As you write your code, save your work either by right-clicking in the Macro Editor and selecting Save Macro from the context menu or by clicking the Save All Macros
button in the Macro Editor toolbar at the top of the Macro Editor.
You must compile your macro before you can run it. To do this, either right click on the macro in the Script Explorer and select Compile Macro from the context menu or click the Compile Macro
button in the Macro Editor toolbar. If there are any errors in your macro, an error message will appear.
When you have a macro that compiles successfully, you can run it either by right clicking in the Script Explorer and selecting Run Macro from the context menu or by clicking the Run Macro
button in the Macro Editor toolbar.