Old 09-11-2019, 08:17 AM   #1
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default Command to select all items on a selected track?

Hi gang,

I always write something similar to the code below... but am thinking there must be some command I'm missing. Like when you double-click on a track panel... all the items for that track are selected.

Is there a command for this in the API that I'm missing?

Code:
----- select all item on 1st selected track ------  
  track = reaper.GetSelectedTrack( 0, 0 )
  num_item_trk = reaper.CountTrackMediaItems( track )
  trk_item = {}
  for i=0, num_item_trk-1 do
      trk_item [i] =  reaper.GetTrackMediaItem( track, i )
      reaper.SetMediaItemSelected( trk_item [i], 1 )
  end
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 09-11-2019, 10:26 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

You don't miss anything. It is how we do it with the API.
X-Raym is offline   Reply With Quote
Old 09-11-2019, 10:33 AM   #3
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by X-Raym View Post
You don't miss anything. It is how we do it with the API.
Thanks X-Raym!
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 09-11-2019, 10:38 AM   #4
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 798
Default

You could shorten it a bit to save some typing.

Code:
tr = reaper.GetSelectedTrack( 0, 0 )
for i=0,reaper.CountTrackMediaItems( tr )-1 do
  reaper.SetMediaItemSelected( reaper.GetTrackMediaItem( tr, i ), 1 )
end
Travesty is offline   Reply With Quote
Old 09-11-2019, 11:19 AM   #5
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by X-Raym View Post
You don't miss anything. It is how we do it with the API.
hi X-Raym

I just sent you a mail with request on your webpage a few days ago.
Did you see it ?
Cause I was worry about if it didn't sent successfuly.
todoublez is offline   Reply With Quote
Old 09-11-2019, 12:26 PM   #6
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by Travesty View Post
You could shorten it a bit to save some typing.

Code:
tr = reaper.GetSelectedTrack( 0, 0 )
for i=0,reaper.CountTrackMediaItems( tr )-1 do
  reaper.SetMediaItemSelected( reaper.GetTrackMediaItem( tr, i ), 1 )
end
Yeah.... very true. I just Copy/Pasted whatever I was working on at the time which required me to track the media items and then later put them at their original selected state.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex 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 08:05 AM.


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