Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 07-10-2020, 06:27 AM   #1
gijsbrechtvanaemstel
Human being with feelings
 
Join Date: Jul 2020
Posts: 21
Default Reascript for showing tracks with similar names

Hi there,

In my projects, I often use a MIDI track and a track to which the MIDI-track is rendered (with FX). For example a track "Strings MIDI". Then I render that track to "Strings" en disable and hide the MIDI track.

Is there a script to find that corresponding MIDI track by its name, based on the current selected (rendered) track?

Thanks in advance,

Gijsbrecht
gijsbrechtvanaemstel is offline   Reply With Quote
Old 07-10-2020, 06:50 AM   #2
xpander
Human being with feelings
 
xpander's Avatar
 
Join Date: Jun 2007
Location: Terra incognita
Posts: 7,670
Default

You could try the Track Manager under the View menu. There is a filter in Track Manager, so you can type the track name in there. Even first few letters might be enough, so that depending on the name, you can get more results.
xpander is offline   Reply With Quote
Old 07-10-2020, 07:01 AM   #3
gijsbrechtvanaemstel
Human being with feelings
 
Join Date: Jul 2020
Posts: 21
Default

Yes, I know, but because it's a repetetive action, I'm looking for a way to automate it, based on the selected track.
gijsbrechtvanaemstel is offline   Reply With Quote
Old 07-10-2020, 09:24 AM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by gijsbrechtvanaemstel View Post
Yes, I know, but because it's a repetetive action, I'm looking for a way to automate it, based on the selected track.
So if the selected track is named "Strings" you want to find the track named "Strings MIDI"? But what is supposed to happen if the track is found?
Heres a quick example, Lua script, it should show a message in the console if match is found.

Code:
function Main()
  local track = reaper.GetSelectedTrack(0,0)
  if not track then return end
  local retval, track_name = reaper.GetSetMediaTrackInfo_String(track, "P_NAME", "", false) 
  local find_track_name = track_name .. ' MIDI'
  local trackcount = reaper.CountTracks()
  for i = 0, trackcount-1 do
    local tr = reaper.GetTrack(0, i)
    local retval, tr_name = reaper.GetSetMediaTrackInfo_String(tr, "P_NAME", "", false) 
    if tr_name == find_track_name then 
      reaper.ShowConsoleMsg("Found '" .. tr_name .. "' at track #" .. i+1 .. '\n')
      break
    end
 end
end

Main()
reaper.defer(function () end)
Edgemeal is offline   Reply With Quote
Old 07-10-2020, 09:26 AM   #5
xpander
Human being with feelings
 
xpander's Avatar
 
Join Date: Jun 2007
Location: Terra incognita
Posts: 7,670
Default

Should be possible to select a track, grab the track name and search same/similar tracks with a script. Maybe somebody knows if there is already something like that?

If you have changed the render track names from the original, I would imagine that would have to be accounted for somehow, maybe with some manual input from you anyway. Also, what do you want to happen with the tracks found such way? Made visible and selected, presented on list, something else?

---
edit: Edgemeal already there, nice...
xpander is offline   Reply With Quote
Old 07-11-2020, 05:42 AM   #6
gijsbrechtvanaemstel
Human being with feelings
 
Join Date: Jul 2020
Posts: 21
Default

Thanks alot! That did the job. When the MIDI track is found I simply make it visible (if it needs to be edited and then rerendered).

Thanks again!
gijsbrechtvanaemstel 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 07:13 AM.


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