nilbefore passing to functions.
RPR_SetExtState("utility", "someflag", "2", True) val=RPR_GetExtState("utility", "someflag") # even if called after REAPER is closed and reopened, val will be equal to "2"
There are also API functions for manually creating undo points, as well as API functions to Undo and Redo previous points.
Undo_EndBlock. If you call
Undo_BeginBlockand then fail to call
Undo_EndBlock, an undo block will be left open, which may cause undesired undo behaviors.
Undo_EndBlockis a bitmask of what you would like to add to the undo state. If you are simply calling other actions (via
Main_OnCommandor similar functions), this should be 0. If you modify the state of the project directly, it's safest to set the bitmask to -1. A more specific combination of flags may be an optimization, depending on what your script is doing.
Undo_EndBlocka valid (non-empty) descriptive string.
reaper.Undo_BeginBlock() m = reaper.GetMasterTrack(0) reaper.TrackFX_GetByName(m, "ReaEQ", 1) reaper.Undo_EndBlock("Add ReaEQ FX to the master track", -1)
function run() is_new,name,sec,cmd,rel,res,val = reaper.get_action_context() if is_new then reaper.ShowConsoleMsg(name .. "\nrel: " .. rel .. "\nres: " .. res .. "\nval = " .. val .. "\n") end reaper.defer(run) end function onexit() reaper.ShowConsoleMsg("<-----\n") end reaper.defer(run) reaper.atexit(onexit)
get_action_context(#fn, sec, cmd); state = GetToggleCommandStateEx(sec, cmd); SetToggleCommandState(sec, cmd, state<=0?1:0); RefreshToolbar2(sec, cmd);