local count_select_item = reaper.CountSelectedMediaItems( 0 )
if count_select_item > 0 then
for i=1, count_select_item do
local item = reaper.GetSelectedMediaItem(0, i-1)
if item then
s=0
take = reaper.GetActiveTake(item)
retval, notecntOut, ccevtcntOut...