No internet connection
  1. Home
  2. How to

Scroll Into View - always Follow Selcted Track (Mix Window)

By Robert Sörling @robertsorling
    2020-03-16 18:36:47.737Z

    Hi. The script "Output Window: Follow Selected Track" is really awesome. Is there a way to get the script Scroll Into View:

    sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
    isControl: true,
    isShift: true,
    });

    to always follow the selected track?

    Thanks

    • 6 replies
    1. You could do it like this...

      But careful - as this will scroll your session whenever you select a new track, which is likely not necessarily what you want.
      I don't currently see a possible workaround to that.

      var lastFocusedTrackName;
      
      function main() {
          try {
      
              var newName = sf.ui.proTools.selectedTrackNames[0];
              if (newName === lastFocusedTrackName || newName === undefined) return;
      
              lastFocusedTrackName = newName;
      
              sf.ui.proTools.selectedTrack.trackScrollToView();
              sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
                  isControl: true,
                  isShift: true,
              });
      
          } catch (err) {
          }
      }
      
      function runForever(name, action, interval, timeout) {
          var now = (new Date).valueOf();
          if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
      
          globalState[name] = now;
          sf.engine.runInBackground(function () {
              try {
                  while (true) {
                      sf.engine.checkForCancellation();
                      globalState[name] = (new Date).valueOf();
      
                      action();
      
                      sf.wait({ intervalMs: interval, executionMode: 'Background' });
                  }
              } finally {
                  globalState[name] = null;
              }
          });
      }
      
      runForever("isScrollToFocusedTrackRunning", main, 500, 5000);
      
      1. RRobert Sörling @robertsorling
          2020-03-24 13:58:52.349Z

          Awesome! This actually fits some of my workflows but I guess what I'm really after is for the mix window to always scroll the selected track to the far left (if possible), without affecting the edit window view. This would be great when working on one screen set ups (like lap tops), not having to switch between mix/edit, if that makes sense?

          1. Oh I see. I changed the title of the question to reflect this now.
            Off the top of my head I don't know how to make the Mix window scroll, but let's leave this question open until we can figure it out.

            1. RRobert Sörling @robertsorling
                2020-03-24 23:54:16.341Z

                Ok, thanks! And thanks for a great app and awesome support!

            2. In reply tochrscheuer:
              Varun John @Varun_John
                2022-02-20 14:40:49.953Z

                Is there any way to bypass this command when not needed ?