Quote:
Originally Posted by Fabian
This maybe does what you want
It goes through all selected tracks, and stretches left items to the border of the next right item. And it seems to work for audio as well as MIDI and empty items.
|
Wow, thank you very much, Fabian, this really works great!!! 🤩⚡️
This is a great script! ✅
The only thing I would also like is to be able to fill empty space not only for the whole track, but also for individual selected items on the track.
When I was watching my thread in this section, I saw another interesting thread: 'Anyone tested any of the 4 ReaScript GPTs yet? (ChatGPT)'.
https://forum.cockos.com/showthread.php?t=287575
I tried to follow the links, but unfortunately all the listed chats require paid GPT v4, which I cannot afford at the moment .
But I decided to try to describe the problem to the free chat GPT v3.5 🤖.
And it seems he was really able to help me)) 🦾
I asked him to adapt for my purposes another script from the user 'Amagalma', called:
'Fill space between selected items with empty items'.
I immediately received an error when I saved the script in Reaper Lua Editor, then described it to the chat ⌨️. He sent me the corrected code and it worked!))
I tested it on both Empty Items and Audio Items - everything is fine
Thanks to the user 'Amagalma', without his open script I couldn't have done anything!)
But if I had waited a little longer, I would have taken your script as a basis, it’s cool script! 📝
Thanks for this, Fabian, it's very helpful too!🎉
Here's what GPT write 👾:
Code:
-- @description Fill space between selected items bt moving right edges
-- @author amagalma
-- @version 1.00
-- @link https://forum.cockos.com/showthread.php?t=248298
-- @donation https://www.paypal.me/amagalma
-- @about
-- #Fills the space between the selected items with empty items
--
-- Inside the script you can set if:
-- - the newly inserted items will be the only selected items
-- - the newly inserted items will have an empty take or be really empty items
-- USER SETTINGS ---------------------------------------------
-- to select only the newly inserted items set to true:
local select_new_items = false -- true/false
-- if true then newly inserted items have an empty take
local new_items_have_empty_take = false -- true/false
--------------------------------------------------------------
local item_cnt = reaper.CountSelectedMediaItems( 0 )
if item_cnt < 2 then return end
for i = 0, item_cnt - 2 do
local item = reaper.GetSelectedMediaItem( 0, i )
local next_item = reaper.GetSelectedMediaItem( 0, i+1 )
local item_pos = reaper.GetMediaItemInfo_Value( item, "D_POSITION" )
local item_len = reaper.GetMediaItemInfo_Value( item, "D_LENGTH" )
local next_item_pos = reaper.GetMediaItemInfo_Value( next_item, "D_POSITION" )
reaper.SetMediaItemInfo_Value( item, "D_LENGTH", next_item_pos - item_pos )
end
if select_new_items then
for i = 0, item_cnt - 1 do
reaper.SetMediaItemSelected( reaper.GetSelectedMediaItem( 0, i ), false )
end
for i = 0, item_cnt - 2 do
reaper.SetMediaItemSelected( reaper.GetSelectedMediaItem( 0, i ), true )
if new_items_have_empty_take then
reaper.AddTakeToMediaItem( reaper.GetSelectedMediaItem( 0, i ) )
end
end
end
reaper.UpdateArrange()
reaper.Undo_OnStateChange( "Moved selected items to fill space" )