1. Macros¶
This section explains how to create and edit macros.
1.1. Usage¶
A macro is used to execute repetitive tasks.
A macro is a Python file that the application can analyze and execute like a script.
A macro is usually started using the OrsPythonPlugins.OrsMacroPlayer.OrsMacroPlayer plugin,
or by a contextual menu.
1.2. File location¶
To be recognized by the application, macros should be located in one of these folders:
- %LocalAppData%/ORS/Dragonfly(version)/pythonUserExtensions/Macros (available for the current user)
- %ProgramData%/ORS/Dragonfly(version)/pythonAllUsersExtensions/Macros (available for all users)
- %ProgramData%/ORS/Dragonfly(version)/python/OrsMacros (distributed with the application)
1.3. File creation¶
To create a macro, start the application, start the OrsPythonPlugins.OrsMacroPlayer.OrsMacroPlayer
(found in Tools/Macro Player),
start the recording and perform the tasks to be recorded in the macro.
This plugin can also create empty macro files.
1.4. File edition¶
The plugin OrsPythonPlugins.OrsMacroPlayer.OrsMacroPlayer can be used to perform simple modifications.
For more advanced modifications, changes can be made directly into the file.
(See ORSServiceClass.macro.macroplayer.MacroPlayer for more information about the structure of a macro file.)
Note
When a macro file is modified, there is no need to restart the application for changes to take effect.
The contextual menus will be automatically updated.
When using the OrsPythonPlugins.OrsMacroPlayer.OrsMacroPlayer plugin, use the reload button
to update the code to run.
1.5. Demos¶
Source code example:
- Download the
file; - Put that file into a macro extension folder;
- Start the application;
- Go to Tools/Macro Player to start the Macro Player;
- Select the macro DemoMacroCreateDatasetAndROI;
- Execute the macro.