Old 02-05-2019, 07:12 AM   #1
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 309
Default Reliably Muting a track by name

Hi guys.
I'm trying to learn how to Mute or Solo a specific Track named "ABCDE" using LUA.

I've read a bit on selecting tracks by name but it's still unclear for me.

Can somebody help me?
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11.6, MBP 17" 2011 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, DP9, PT 11, Logic Pro X, Bidule, M5 3, BFD2, SD2, Omnisphere, Wave Altiverb, PSP, VB3, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is offline   Reply With Quote
Old 02-05-2019, 08:17 AM   #2
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 551
Default

Archie has a script
'Select a track by name(abbreviated input)'
Maybe you could modify that to also mute/solo

You will need Reapack installed http://www.reapack.com
--------------------------------------------------

Then..
сopy and paste this URL in Extensions > ReaPack > Import a repository

github.com/ArchieScript/Archie_ReaScripts/raw/master/index.xml

There's some great stuff in there good to learn from.
With this script in particular you can do a lot of things by track name as well as selection.
__________________
I've been imitated so well I've heard people copy my mistakes. - Jimi Hendrix

Last edited by J Reverb; 02-05-2019 at 08:26 AM.
J Reverb is online now   Reply With Quote
Old 02-05-2019, 10:57 AM   #3
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,482
Default

Same as https://forum.cockos.com/showthread.php?p=2088439, but with reaper.SetMediaTrackInfo_Value(track, 'B_MUTE', 1) instead of SetOnlyTrackSelected.

Code:
function getTrackByName(name)
  for trackIndex = 0, reaper.CountTracks(0) - 1 do
    local track = reaper.GetTrack(0, trackIndex)
    local ok, trackName = reaper.GetSetMediaTrackInfo_String(track, 'P_NAME', '', false)

    if ok and trackName == name then
      return track -- found it! stopping the search here
    end
  end
end

-- The track variable will contain the matching track
-- or nil if none are found in the current project.
local track = getTrackByName("ABCDE")

if track then -- only mute it if it was found (not nil)
  reaper.SetMediaTrackInfo_Value(track, 'B_MUTE', 1)
end
cfillion is online now   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:35 AM.


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