No internet connection

Track Output window follow track selection

By samuel henriques @samuel_henriques2020-09-09 15:54:02.519Z

I'm using this script to keep the track output window open and changing to the last selected track, and works fine.
Could anyone help me change it so it would; only if the Output window is open; at this time if the window is closed it opens it;
2: only on any track that start with these words; a loose thing, I guess
" _MUSICA" and " _FX".

Thank you so much

var lastFocusedTrackName;

function main() {
    try {

        var newName = sf.ui.proTools.selectedTrackNames[0];
        if (newName === lastFocusedTrackName || newName === undefined) return;

        lastFocusedTrackName = newName;


    } 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) {
                globalState[name] = (new Date).valueOf();


                sf.wait({ intervalMs: interval, executionMode: 'Background' });
        } finally {
            globalState[name] = null;

runForever("isScrollToFocusedTrackRunning", main, 500, 5000);

Solved in post #7, click to view
  • 9 replies
  1. Christian Scheuer @chrscheuer2020-09-09 15:57:25.255Z

    Just clarifying..
    So what should happen if the track output window is open and you're on a "_FX.." track but you move to a track that's not a "_FX" track. Should it then close the output window? Or just not change the output window and leave it open?

    1. Ssamuel henriques @samuel_henriques2020-09-09 16:12:53.452Z

      Hey Christian,
      Forgot that one.
      I would like it to stay open.
      for example, I can select an _FX and if I click a dialog the _FX 's output window will still be there.
      Thank you, that was fast

      1. Christian Scheuer @chrscheuer2020-09-09 17:02:10.438Z

        Ok, so to be sure, you just want the script changed so that it doesn't open the track output window?

        1. Christian Scheuer @chrscheuer2020-09-09 17:05:05.002Z

          You should be able to change this:


          To this:

          if (sf.ui.proTools.mainTrackOutputWindow.invalidate().exists && sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value !== 'open')
          1. Ssamuel henriques @samuel_henriques2020-09-09 17:21:01.406Z

            Perfect that's one of the things.
            Now, when its open, only follow the track selection of tracks whose name start with " _MUSICA" and " _FX".

            thank you

            1. Christian Scheuer @chrscheuer2020-09-09 17:31:42.329Z

              Then, change it to:

              if (sf.ui.proTools.mainTrackOutputWindow.invalidate().exists && sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value !== 'open' && (newName.indexOf(' _MUSICA') == 0 || newName.indexOf(' _FX') == 0))
              1. Ssamuel henriques @samuel_henriques2020-09-09 17:36:36.574Z

                Sorry, It's not following any now.

                thank you for your patience

                1. Christian Scheuer @chrscheuer2020-09-09 17:49:45.817Z

                  It's likely you need to adjust the names as quoted in the script. You put them as a space followed by an underscore and then the letters. If you didn't mean to put in a space, remove it in the script.

                  1. Ssamuel henriques @samuel_henriques2020-09-09 17:54:04.366Z

                    Awesome !!!!

                    Thank you so much