Reaper-Scripts/4PointCutting/4Pcut_set_DST-IN.lua

25 lines
757 B
Lua

local nof_markers = 0
local id = -1
-- check if marker already exists
_, nof_markers, _ = reaper.CountProjectMarkers(0)
for i = 0, nof_markers - 1 do
local name_tmp = ''
local isregion_tmp = false
local id_tmp = 0
_, isregion_tmp, _, _, name_tmp, id_tmp = reaper.EnumProjectMarkers(i)
if not isregion then
if name_tmp == 'DST-IN_4Pcut' then
id = id_tmp
break
end
end
end
if id >= 0 then
-- edit existing marker
reaper.SetProjectMarker(id, false, reaper.GetCursorPosition(), 0, 'DST-IN_4Pcut')
else
-- create new marker
reaper.AddProjectMarker2(0, false, reaper.GetCursorPosition(), 0, 'DST-IN_4Pcut', -1, reaper.ColorToNative(0, 255, 0)|0x1000000)
end