Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Move all project markers by the same amount in seconds
- local retval, num_markers, _ = reaper.CountProjectMarkers(0)
- if num_markers == 0 then reaper.MB("No markers in the project.","Error",0) return end
- local retval, value = reaper.GetUserInputs("Move all markers by..", 1, "Format = sec.ms", "")
- if not retval or value == "" then return end
- local value = value:match("(%-?%d*%.?%d*)")
- if not value then reaper.MB("Illegal entry.","Error",0) return end
- -- Save all project markers IDs
- local i = 0
- local t = {}
- while i < num_markers do
- local retval, _, pos, _, name, id = reaper.EnumProjectMarkers2(0, i)
- t[id] = pos + value
- i = i + 1
- end
- reaper.Undo_BeginBlock()
- -- Move all saved project markers
- for k,v in pairs(t) do
- reaper.SetProjectMarker2(0, k, false, v, 0, "")
- i = i + 1
- end
- -- Done in stages since setting marker in the same loop as enumeration messes up their order while they're being moved
- reaper.Undo_EndBlock('Move all project markers by '..value..' sec',-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement