Test code:
Code:
env = reaper.GetSelectedEnvelope( 0 )
if env then
-- create AI
ai = reaper.InsertAutomationItem( env, 0, 4, 6 )
-- move AI somewhere else
reaper.GetSetAutomationItemInfo( env, ai, "D_POSITION", 12, true )
-- create Undo
reaper.Undo_OnStateChangeEx( "bla", 1, -1 )
else
return
end
Undoing does not return to original state before running the script but to the insertion of the AI point.