No internet connection
  1. Home
  2. How to

How do you 'scroll into view' the current track

By Andreas Sandborg @Sandborg
    2019-04-11 09:15:57.506Z

    Hi.
    I don't know how much you are up for feature requests, but I would love to be able to have a shortcut for 'scroll into view' for the currently selected track.
    This would save having to use the mouse, right clicking on the track and going through the menu.
    But I don't really know if this would even be possible?

    Best regards Andreas

    Solved in post #2, click to view
    • 15 replies
    1. Hi @Sandborg.
      Thanks for posting.
      We don't usually distinguish between feature requests and "How to" questions, since often what the user thinks is a feature request, in actuality is asking how to do something, since it's already possible in SF.
      The same goes for your question here.

      This script will simulate scrolling to the currently selected track (banking your peripherals to that channel), with the caveat that it will only work if that selected track is already visible on screen.

      sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
          isControl: true,
          isShift: true,
      });
      
      ReplySolution
      1. SAndreas Sandborg @Sandborg
          2019-04-12 11:46:45.018Z

          Thanks @chrscheuer!

          That's brilliant. Everything I asked for!

          1. GGraham Archer @Graham_Archer
              2019-10-21 21:03:55.231Z

              Hey @chrscheuer is there any way to do this when the track is not visible on the screen? Maybe with some combination of page up and page down buttons?

              1. You can use the trackScrollToView action before the above:

                sf.ui.proTools.selectedTrack.trackScrollToView();
                sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
                    isControl: true,
                    isShift: true,
                });
                
                1. JJoe Just @Joe_Just
                    2023-10-16 16:12:59.074Z

                    I gratefully borrowed this short script some time ago and have found it very handy. But now, having recently upgraded to the most recent version of Pro Tools, the command no longer works reliably.

                    I believe this may be due to an apparent subtle re-design of the Pro Tools UI, in which the positioning of the title button in the track seems to have been slightly changed....so that the "mouseClickElement" item in the script now does not land on coordinates within the title button. I see that Folder tracks DO still work with this Scroll Into View script, but not other track types -- and a close look at Folder tracks shows that the positioning of the title button in the track display is indeed a bit offset from those in other track types (it's positioned a little lower in the track display).

                    So it seems that this is an issue springing from the new UI....does anyone have an idea for a workaround? I was so enjoying this simple command!

                    1. Hi Joe,

                      Yes, I believe you need to add a relativePosition to the mouseClickElement - @Kitch knows more as he did the original troubleshooting for this.

                      1. In reply toJoe_Just:
                        Kitch Membery @Kitch2023-10-16 17:45:04.716Z

                        Hi @Joe_Just,

                        I believe your assumption is correct, and as Christian mentioned, adding a relative offset to the mouseClickElement method should fix the issue.

                        Try this :-)

                        sf.ui.proTools.selectedTrack.trackScrollToView();
                        sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
                            relativePosition: { x: 5, y: 5 },
                            isControl: true,
                            isShift: true,
                        });
                        

                        Let me know if that works for you.

                        1. JJoe Just @Joe_Just
                            2023-10-16 18:28:11.283Z

                            Thanks Kitch! Works perfect. If I had any skills writing scripts I might have been able to go beyond diagnosis and figure out this straightforward solution myself. Maybe this can be an impetus for me to start learning. Much appreciated.

                            1. Kitch Membery @Kitch2023-10-16 18:37:02.105Z

                              You're welcome @Joe_Just. Glad it worked for you :-)

                2. J
                  In reply toSandborg:
                  Jordon Popp @Jordon_Popp
                    2025-01-02 00:12:46.535Z

                    Is there a way to have this run on the mix window?

                    1. Hey @Jordon_Popp,

                      Sorry for the late reply but the script below should work in the Mix window

                    2. In reply toSandborg:
                      Donald Richard @Donald_Richard
                        2025-03-10 16:50:23.707Z

                        New to scripting here. how would I make a macro that would do the following. I click the button on my stream deck and it would Shift+CTRL Plus click whatever channel I have it set to. for example I want my stream deck to have a button for Kick, Snare, Hats etc and I want to be able to click Kick. and it brings the kick up on my SSL. Thanks so much

                        1. Hey @unnamed_483,

                          I'm assuming that ctrl-shift clicking on a track, which (scrolls a track to the top of the edit window & to the left in the mix window) also selects it on your SSL controller.

                          There's always the possibility that the desired track is scrolled offscreen so shift-ctrl clicking would not be possible. However, using "Scroll to track…" from PT's track menu does the same thing.
                          This script should do it. Make a copy of it for each track you want to scroll to and change the value of the trackName variable at the top of the script:

                          const trackName = "Kick"
                          
                          /**
                          * Scrolls to first track name passed to the top of PT edit screen
                          * @param {string |string[]}trackNames
                          */
                          function csScrollToTrack(trackNames) {
                              sf.ui.proTools.appActivate()
                              const menuClickScrollToTrack = () => sf.ui.proTools.menuClick({ menuPath: ['Track', 'Scroll to Track...'] })
                              var confirmationDialogWin = sf.ui.proTools.confirmationDialog;
                              var scrollTrack = (typeof trackNames == "object") ? trackNames[0] : trackNames;
                          
                              try {
                                  menuClickScrollToTrack();
                          
                                  confirmationDialogWin.elementWaitFor({ timeout: 250 });
                          
                              } catch (err) {
                                  sf.ui.proTools.refreshMenuItems()
                          
                                  menuClickScrollToTrack();
                          
                                  confirmationDialogWin.elementWaitFor({}, `Could not find Scroll to track Dialog`);
                              }
                              sf.wait({ intervalMs: 250 })
                          
                              confirmationDialogWin.textFields.first.elementSetTextFieldWithAreaValue({
                                  value: scrollTrack,
                                  useMouseKeyboard: true
                              });
                          
                              sf.waitFor({
                                  callback: () => confirmationDialogWin.textFields.first.value.invalidate().value == scrollTrack
                              })
                          
                              confirmationDialogWin.buttons.whoseTitle.is('OK').first.elementClick();
                          
                              confirmationDialogWin.elementWaitFor({ waitType: 'Disappear' });
                          }
                          
                          
                          //////////
                          // Main //
                          //////////
                          
                          csScrollToTrack(trackName)
                          
                          1. Donald Richard @Donald_Richard
                              2025-03-11 17:05:58.172Z

                              Thanks so much. Can’t wait to give this a shot!

                              1. In reply toChris_Shaw:
                                Donald Richard @Donald_Richard
                                  2025-03-12 17:21:03.441Z

                                  This is working great. Can't believe no one built something like that for controllers yet! at least the ones that don't follow the selection.

                                  Thanks so much