Call Undo / Redo from Script?

I don’t mean beginUndo(), endUndo() but to actually make Glyphs App do an Undo/Redo for a layer or glyph?

I’d like to write a script that would let me:

  1. Set a Save History State

Then I do whatever experimenting edits I want, and if I decide it’s not any good:

  1. Undo to this history state.

Usually I would revert, but then that takes away all the previous undo states too.

Don’t tinker with the Undo history. Why not simply copy the layer?

Ah ok, I just found myself doing a lot of things and then having to undo a lot, hence I ended up creating an applescript to do Undo 10 Times, but that means i have to watch the undo actually happen which slows it down.