TrackName = "TrackName";--Set TrackName(for FIXED NAME(no DEL))
SendNum = 1;--Set SendNum
TrackNum = 1;--init
trackidx = 0;--init
tracks_count = reaper.CountTracks(0);
i=0;
while i < tracks_count do
trackidx = reaper.GetTrack(0, i);
retval,i_TrackName = reaper.GetSetMediaTrackInfo_String(trackidx, "P_NAME","i_TrackName", 0);
----compare Names and get TrackNum if equals---
if i_TrackName == TrackName then
TrackNameIdx = trackidx;--Optional(if need trackidx for another actions)
TrackNum = i+1;--TrackNum for OSC msg
end
i = i+1;
end
count = 0;--Only for cycles-count
----String concatenation----
msgSendVol = "/track/"..TrackNum.."/send/"..SendNum.."/volume"; --for SendVol-OSC msg
--msgSendPan = "/track/" ..TrackNum.."/send/"..SendNum.."/pan";--for SendPan-OSC msg
function run()
is_new,name,sec,cmd,rel,res,val = reaper.get_action_context();
if is_new then
reaper.OscLocalMessageToHost(msgSendVol,(val/127));--OSC send-vol(trackname,sendnum)
--reaper.OscLocalMessageToHost(msgSendPan,(val/127));--OSC send-pan(trackname,sendnum)
count = count + 1;
end
reaper.defer(run);
end
reaper.defer(run);