-- Reaper Scripts for 4 point editing. This script sets the Destination End marker to the position of the edit cursor -- Author: Ludwig Frühschütz -- Source: https://www.eleton-audio.de -- Git: https://files.eleton-audio.de/gitea/Ludwig/Reaper-Scripts.git -- License: GPL v3.0 -- Requires: Reaper 5 or 6 -- Requires: This script goes with several other scripts that work closely together. local nof_markers = 0 local nof_regions = 0 local id = -1 -- check if marker already exists _, nof_markers, nof_regions = reaper.CountProjectMarkers(0) nof_markers = nof_markers + nof_regions -- adapt count of 'CountProjectMarkers()' to 'EnumProjectMarkers()' 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-OUT_4Pcut' then id = id_tmp break end end end if id >= 0 then -- edit existing marker reaper.SetProjectMarker(id, false, reaper.GetCursorPosition(), 0, 'DST-OUT_4Pcut') else -- create new marker reaper.AddProjectMarker2(0, false, reaper.GetCursorPosition(), 0, 'DST-OUT_4Pcut', -1, reaper.ColorToNative(0, 255, 0)|0x1000000) end