diff --git a/Items Editing/amagalma_Convert empty items with notes to dedicated video processor item named after the notes.lua b/Items Editing/amagalma_Convert empty items with notes to dedicated video processor item named after the notes.lua new file mode 100644 index 000000000..38ba6a680 --- /dev/null +++ b/Items Editing/amagalma_Convert empty items with notes to dedicated video processor item named after the notes.lua @@ -0,0 +1,48 @@ +-- @description Convert empty items with notes to dedicated video processor item named after the notes +-- @author amagalma +-- @version 1.00 +-- @donation https://www.paypal.me/amagalma + + +local item_cnt = reaper.CountSelectedMediaItems( 0 ) +if item_cnt == 0 then + return reaper.defer(function() end) +end + +local function ConvertEmptyItem( item ) + if reaper.GetActiveTake( item ) then return end + local ok, notes = reaper.GetSetMediaItemInfo_String( item, "P_NOTES", "", false ) + if ok and notes ~= "" then + local ok2, chunk = reaper.GetItemStateChunk( item, "", false ) + if ok2 then + chunk = chunk:match("(.+) +CODEPARM 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +> +>]] + reaper.SetItemStateChunk( item, chunk, false ) + end + end +end + +---------- + +reaper.PreventUIRefresh( 1 ) + +for i = 0, item_cnt-1 do + local item = reaper.GetSelectedMediaItem( 0 , i ) + ConvertEmptyItem( item ) +end + +reaper.PreventUIRefresh( -1 ) +reaper.Undo_OnStateChangeEx( "Convert empty items", 4, -1 )