Macro language
A macro is a plain-text list of commands, one per line, that drives the Mantis UI: opening panels, switching tools, setting the plot axes, changing the legend strategy and changing the map’s view mode. It is not a general scripting language. There are five verbs and no variables, conditions, or loops.
Shape of a command
Every command is a verb followed by double-quoted arguments:
panel "open" "Bags"
plot "likes" "views"
legend "Clusters"
tool "lasso"
views "2.5d"The parser pulls the quoted strings out of the line in order and takes the first one or two, depending on the verb. Anything outside the quotes is ignored, so trailing notes are harmless but there are no comments as such. Lines that start with a triple backtick are skipped, and blank lines are dropped when a macro is saved.
Lines whose first word is not one of the five verbs are given no command type and do nothing at all. Nothing warns you: a typo is silently a no-op.
panel: open and close panels
panel "open" "Inspector"
panel "close" "Tree"
panel "Bags"With one argument the panel is opened. With two, the first must be open or close (case-insensitive); anything else is treated as a panel name to open.
The panel name is matched case-insensitively against the widget key, the display name, or the component id of every panel in the View menu. panel "macrorunner", panel "Macro Runner" and panel "MacroRunner" all target the same panel. Opening a panel that is already open selects its tab instead of adding a second copy, and for most panels Mantis will not open more copies than there are open maps.
Heads up
The ? help popover in the Create Macro dialog lists analysis, interpreter, chat and layers as panel names. Those panels no longer exist, so those commands do nothing. Any current View menu entry works, including ones the popover omits.
plot: set the plot axes
plot "age" "height"Takes exactly two arguments and sets the X and Y dimensions used by the plot panels. The names must match dimensions in your data. Nothing validates them.
legend: set the color strategy
legend "Clusters"Sets the active legend strategy for the map. The value is passed through unchanged, so it must match a strategy the current space actually has.
tool: select a map tool
tool "lasso"Recognized tools: select, lasso, magic lasso, path, landmark, waypoint, clear bags, delete bags, settings, constructor, and Journey.
Names are looked up literally first and then in lowercase, so every name above works in lowercase except Journey, which is only registered capitalized. tool "journey" throws and aborts the rest of the macro.
views: change map view settings
views "2.5d"
views "show trajectory"
views "point_size 6"| Argument | Effect |
|---|---|
2d, 2.5d | Set the map render mode |
3d | Sets a 3D view mode; the 3D toggle is not shipped in the map UI |
show tools | Toggle the tool overlay |
show focused | Toggle focus mode |
show trajectory | Toggle trajectory display |
point_size N (or point_scale N) | Set point size to the number N |
bubble_size N | Set bubble size to the number N |
The numeric forms take the value inside the same quoted string, separated by a space.
Verbs that are parsed but do nothing
The Runner recognizes lines starting with search and create_bag and gives them a command type, but no handler is registered for either, so they have no effect. The recorder can also emit load, filter, sort, select and annotate lines from its action taxonomy; none of those have handlers either. Treat the five verbs above as the whole language.
Recording a macro
Rather than writing commands by hand, you can record them. Open Macro Marketplace and click Record Macro.
- Click Record Macro. A red “Recording in progress…” banner appears in the panel and a red
Recording...badge pins itself to the top right of the window. - Work in Mantis as usual. Open and close panels, switch tools, change view settings, run map searches.
- Click Stop Recording. If anything was captured, the Create Macro dialog opens with the commands already filled into the code box.
- Name it and click Create. Use Clear Recording in the dialog to throw the captured commands away first.
What recording actually captures
Recording subscribes to the panel store and the tool store directly, and listens for two events the app dispatches:
- Panel opens and closes become
panel "Name"andpanel "close" "Name". - Tool changes become
tool "name". - View setting changes made in Map Settings or the map’s settings popover become
views "...". - Map searches become
search "..."lines, which do not replay.
Creating a bag, changing the plot axes, changing the legend, filtering, sorting and annotating are all in the recorder’s taxonomy, but nothing in the app currently fires those events, so they are never recorded. Add those lines by hand if you need them.
Starting a new recording clears the previous one, and a recording only lives as long as the Marketplace panel stays mounted. Stop and save before you close it.
Read nextMacro MarketplaceWhere macros are created, recorded and installed.