No internet connection
  1. Home
  2. How to

(Pro Tools) Command for a track with no consistent track name

By Niklas Lueger @Niklas_Lueger
    2022-12-08 14:09:23.904Z2022-12-08 17:56:57.287Z

    quoted text

    Hello,

    I've recently started using Soundflow and can't find a suitable solution for the monitoring commands I would like to implement.
    I'm on Pro Tools and I have a dedicated monitor audio track that receives signal from the mix bus, but also has reference tracks on it, so I can switch between my mix and older/other mixes by pressing the input monitoring button.

    For now I'm using this script I found online:

    *function trackToggleInput(trackName) {
        var track = sf.ui.proTools.trackGetByName({ name: trackName }).track;
        var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first;
        inputBtn.elementClick();
    }
    
    trackToggleInput('MONITOR');*
    

    The problem here is, that by changing the playlist on my monitor track, the track is no longer visible as 'Monitor', hence the command does not run. Pro Tools does not allow multiple playlists to have the same name.

    Is there a simple way to work around that issue? My first thought was a command which selects the mix bus track (which always has the same name) and then moves one track downwards in the selection, so that the different names of the monitor track are not an issue anymore.

    I'd very much appreciate help with this!
    Thank you

    Solved in post #3, click to view
    • 4 replies
    1. Kitch Membery @Kitch2022-12-08 18:07:15.436Z

      Hi @Niklas_Lueger,

      Great question. You could do something like this, which will toggle the input monitor button for the first track who's name starts with "MONITOR".

      function trackToggleInput(trackName) {
          sf.ui.proTools.mainWindow.invalidate();
      
          const visibleTrackNames = sf.ui.proTools.visibleTrackNames;
      
          const targetTrackName = visibleTrackNames.find(name => name.startsWith(trackName));
      
          const track = sf.ui.proTools.trackGetByName({ name: targetTrackName }).track;
      
          const inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first;
      
          inputBtn.elementClick();
      }
      
      trackToggleInput('MONITOR');
      

      Rock on!

      1. I think the issue is that when @Niklas_Lueger switches the playlist on the track he wants to input toggle the script won't work.

        Since the track being toggled is always under the master we can get the correct track name by finding the track index and selecting the track below it by increasing the track index by 1:
        Just change the name of the mix bus track name in the first line…

        const mixBusName = "---Master---";
        
        function trackToggleInput(mixBusName) {
            sf.ui.proTools.mainWindow.invalidate();
        
            const visibleTrackNames = sf.ui.proTools.visibleTrackNames;
        
            const mixBusIndex = visibleTrackNames.indexOf(mixBusName)
        
            const targetTrackName = visibleTrackNames[mixBusIndex + 1];
        
            const track = sf.ui.proTools.trackGetByName({ name: targetTrackName }).track;
        
            const inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first;
        
            inputBtn.elementClick();
        }
        
        trackToggleInput(mixBusName)
        
        Reply2 LikesSolution
        1. Kitch Membery @Kitch2022-12-08 20:46:33.739Z

          Ah yeah, I was only thinking of the playlist name incrementing, not changing completly. Thanks for the follow-up Chris, My morning coffee had not set in yet. :-)

          1. In reply toChris_Shaw:
            NNiklas Lueger @Niklas_Lueger
              2022-12-09 22:40:48.393Z

              Amazing! That’s exactly what I was looking for

              Thank you for your help!