Old 10-15-2018, 07:31 PM   #1
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default Lua Script:Select items under edit cursor

Code:
local item={}

pos=reaper.GetCursorPosition()

itemnumbers=reaper.CountMediaItems()

  for i=0,itemnumbers-1 do
  
     item[i]=reaper.GetMediaItem(0,i)
     
     item_pos=reaper.GetMediaItemInfo_Value(item[i], "D_POSITION")
     
     item_length=reaper.GetMediaItemInfo_Value(item[i], "D_LENGTH")
     
     if item_pos<=pos and item_pos+item_length>pos then
     
        reaper.SetMediaItemSelected(item[i],1)
        
      end
      
  end

reaper.UpdateArrange()


Hope it will be useful to some of you
Attached Images
File Type: gif script.gif (54.8 KB, 654 views)
dsyrock is offline   Reply With Quote
Old 10-16-2018, 03:48 AM   #2
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Great stuff! I really thought that such a basic (in terms of useful!) command is already available on ReaPack, but it's not!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 10-16-2018, 04:10 AM   #3
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by _Stevie_ View Post
Great stuff! I really thought that such a basic (in terms of useful!) command is already available on ReaPack, but it's not!
Thanks. Actually there is an action called"Xenakios/SWS: Select items under edit cursor on selected tracks" in SWS. But it need to select some tracks first. I change that a little bit
dsyrock is offline   Reply With Quote
Old 10-16-2018, 06:22 AM   #4
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Yeah, saw that SWS command! But as you mentioned, it only works for selected tracks and selecting all the desired tracks is an additional step. So, your version comes very handy!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ 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 01:36 PM.


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