No internet connection
  1. Home
  2. How to

Select First Track? Unmute and Solo

By Jack Green @Jack_Green
    2022-04-20 15:23:05.133Z

    Hi,

    Very new and I know nothing about scripting...

    Basically looking to Select the first track in my session (This is always the Reference mix supplied by my client) Unmute it and solo it, Then on the next press Mute and Unsolo it. It always the first track of the session but i dont normally bother naming it anything special.

    Ive seen some posts on solo and muting, And some on selecting the last track of a session. But I dont know how to adapt the code to make it the first track.

    Thanks in advance

    Jack

    Solved in post #2, click to view
    • 2 replies
    1. This should do it:

      sf.ui.proTools.mainWindow.invalidate();
      
      function getSoloState(trackName) {
          const track = sf.ui.proTools.trackGetByName({ name: trackName }).track;
          const trackHasSoloBtn = !track.title.invalidate().value.endsWith(" - Master Track ");
          return trackHasSoloBtn ? track.isSoloed : false;
      };
      
      // Get first visible track in session
      const firstTrack = sf.ui.proTools.visibleTrackNames[0];
      
      // Define first track solo button
      const firstSoloButton = sf.ui.proTools.trackGetByName({ name: firstTrack }).track.buttons.whoseTitle.is("Solo").first;
      
      // Get tracks that are currently selected
      const origSelectedTracks = sf.ui.proTools.selectedTrackNames
      
      if (getSoloState(firstTrack) == false) {  // If track isn't solo-ed unmute track and click solo button
          sf.ui.proTools.trackSetMuteByName({
              name: firstTrack,
              targetValue: 'Disable'
          });
      
          firstSoloButton.elementClick();
      
      } else {
      
          // If track is solo-ed mute track and click solo button
          sf.ui.proTools.trackSetMuteByName({
              name: firstTrack,
              targetValue: 'Enable'
          });
      
          firstSoloButton.elementClick();
      };
      
      ReplySolution
      1. In reply toJack_Green:
        Jack Green @Jack_Green
          2022-04-21 09:22:05.029Z

          Worked perfectly

          Thankyou!!

          1. Progress
          2. @Jack_Green closed this topic 2022-04-21 09:22:18.373Z.
          3. @Jack_Green reopened this topic 2022-04-21 09:22:24.293Z.