No internet connection
  1. Home
  2. How to

Selecting Last Track In Session

By Andrew Downes @Andrew_Downes
    2022-02-24 03:45:50.347Z

    A simple question I think;
    Can you select the last track in a session without knowing its name and without having it scroll into view?
    Thanks

    • 5 replies
    1. @Andrew_Downes, yeah! Here you go:

      function selectLastTrackInSession() {
          sf.ui.proTools.appActivateMainWindow();
          sf.ui.proTools.mainWindow.invalidate();
      
          const trackNames = sf.ui.proTools.trackNames;
      
          sf.ui.proTools.trackSelectByName({
              names: [trackNames[trackNames.length - 1]]
          });
      }
      
      selectLastTrackInSession();
      
      1. MMarkus Meyer @Markus_Meyer
          2023-08-22 04:06:10.379Z2023-08-22 08:18:08.789Z

          @raphaelsepulveda Raphael, is there a way to add the "control shift" command to this action so the edit window scrolls down to the last track? I have been trying to figure this out but unfortunately, I have no clue! Thank you so much

          1. Unfortunately, using that command only works if the track is already visible on the screen. I suggest using an "end" keystroke to bring the Edit window all the way down. Just place this line at the end of the script:

            sf.keyboard.press({ keys: "end" }); // Bring Edit window down to last track
            
            1. MMarkus Meyer @Markus_Meyer
                2023-08-22 18:39:55.753Z

                Different Key Command, same action. Works perfectly and does exactly what I want it to do. Thank you so much Raphael

          2. A
            In reply toAndrew_Downes:
            Andrew Downes @Andrew_Downes
              2022-02-24 04:51:49.974Z

              I thank you very much!