Can I bundle mod-script-pipe actions for Undo?

I’m running my python script through mod-script-pipe on v3. The script sends many small actions.
When something goes wrong user can undo the actions in Audacity manually. My question…
Is it possible to send those actions as a kind of block so that each undo would revert a block of actions?

The way that I’ve done in the past is to send “Undo:” the required number of times (with a loop).

Check the commands by running through them manually. The number of "Undo"s required can be tricky to get right because some actions don’t create steps in the history.

Another way might be to create a Macro for a block of commands. A macro “should” be one step in the Undo History (this isn’t perfect yet, so you will need to check manually). You can then send, from Python, a command to run the macro, followed by one “Undo” to undo all the steps in the macro.

Thanks Steve.
I think I leave this for the moment. I was hoping that I could send a kind of Undo-begin and Undo-end to bundle the actions :laughing: