Quote:
Originally Posted by Argitoth
Hmm, another simple action is missing. There's an action "Xenakois/SWS: Select items under edit cursor on selected tracks" but I don't want the "on selected tracks" part of it.
I need this:
"Select items under edit cursor"
|
Select items under edit cursor (unselect other items):
Code:
#Select items under edit cursor (unselect other items)
from reaper_python import *
from contextlib import contextmanager
@contextmanager
def undoable(message):
RPR_Undo_BeginBlock2(0)
try:
yield
finally:
RPR_Undo_EndBlock2(0, message, -1)
with undoable("Select items under edit cursor"):
def msg(m):
RPR_ShowConsoleMsg(m)
unSelAllItems = 40289
RPR_Main_OnCommandEx(unSelAllItems, 0, 0)
for i in range(RPR_CountMediaItems(0)):
itemId = RPR_GetMediaItem(0, i)
itemStartPos = float(RPR_GetMediaItemInfo_Value(itemId, "D_POSITION"))
itemEndPos = itemStartPos + float(RPR_GetMediaItemInfo_Value(itemId, "D_LENGTH"))
if itemStartPos <= RPR_GetCursorPositionEx(0) <= itemEndPos:
RPR_SetMediaItemInfo_Value(itemId, "B_UISEL", 1)
# update view
RPR_UpdateArrange()