Python code to Play a Macro


I have recorded a Macro in slicer and I would like to know if there is a Python command to play the Macro via the python interactor, instead of having to click on the button.

Macro recording may seem like a good way to get start with automating Slicer, but the current Slicer macro recorder captures low-level events, which are not very useful. We have kind of left this feature behind: it seems there is no API for starting macro playback from Python, and I don’t think macro recording even works in latest Slicer versions.

Instead we use Python scripting for automating Slicer. With very few exceptions (such as this macro recorder) all user actions are accessible via Python commands. A good starting point is the Script Repository which contain complete examples of the most commonly needed actions.

Thank you for your answer. I understand what you are saying, I am testing the use of the macro.
I know there are ways to custom keyboard shortcuts for slicer, do you know how I can program a shortcut to “press” the Play Macro button?