Old 01-12-2018, 01:58 AM   #1
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default Remove Items in Track Time Selection by Color

I have a lot of clips with different item colors in line one after the other and layered behind each other in a track time selection and I only need to keep the ones if item color_int = 19362827 and remove the others.
MusoBob is offline   Reply With Quote
Old 01-12-2018, 06:21 PM   #2
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Like this and just leave green, if color_int ~= 19362827 then remove item.

MusoBob is offline   Reply With Quote
Old 01-17-2018, 02:36 PM   #3
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Code:
     
reaper.Main_OnCommand(40630,0) -- Go to start of time selection 40630   
reaper.Main_OnCommand(40718,0) -- Item: Select all items on selected tracks in current time selection 40718

for i = 0, reaper.CountSelectedMediaItems(0)-1 do
      
       isdel = reaper.GetSelectedMediaItem( 0, i )
       track = reaper.GetMediaItemTrack(isdel)
       color = reaper.GetMediaItemInfo_Value(isdel, ("I_CUSTOMCOLOR"))
       if color ~= 19362827 then  reaper.DeleteTrackMediaItem( track, isdel )
     
       end
end
MusoBob is offline   Reply With Quote
Old 01-23-2018, 01:30 PM   #4
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

This works for both Win and Mac using RGB rather than color int.

Code:
reaper.Main_OnCommand(40630,0) -- Go to start of time selection 40630   
reaper.Main_OnCommand(40718,0) -- Item: Select all items on selected tracks in current time selection 40718

     track = reaper.GetSelectedTrack(0,0)    
     item_count = reaper.CountSelectedMediaItems(0)
     for i = 0, item_count -1 do

     isdel = reaper.GetSelectedMediaItem( 0, i )  

       if isdel then
       color = reaper.GetMediaItemInfo_Value(isdel, ("I_CUSTOMCOLOR"))
       rOut, gOut, bOut = reaper.ColorFromNative(color)

       if (rOut ~= 115) and (gOut ~= 23) and (bOut ~= 17) then  reaper.DeleteTrackMediaItem( track, isdel )
       
       end
     end 
   end
MusoBob is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.