REAPER KB

Undo

reascript_prose/reascript-howto-undo · kind=reference

Undo

Group script-driven changes into a single undo point with Undo_BeginBlock and Undo_EndBlock.

Kind: how-to

Undo points are created for ReaScripts by default. To prevent the automatic addition of an undo point, a script can call defer()/ reaper.defer()/ RPR_defer().

There are also API functions for manually creating undo points, as well as API functions to Undo and Redo previous points.

The best way to manually create an undo point for your script is to call Undo_BeginBlock() before most of your code, and Undo_EndBlock() after your code finishes.

Lua example:

reaper.Undo_BeginBlock()
m = reaper.GetMasterTrack(0)
reaper.TrackFX_GetByName(m, "ReaEQ", 1)
reaper.Undo_EndBlock("Add ReaEQ FX to the master track", -1)

undo flags for Undo_EndBlock() et al:

Other sections in this document