No internet connection
  1. Home
  2. Macro and Script Help

Scroll into View at top of arrangement window.

By Ralph Verdult @Ralph_Verdult
    2024-11-27 15:10:37.007Z

    Title

    Scroll into View at top of arrangement window.

    What do you expect to happen when you run the script/macro?

    I've got a small script that I want to use to navigate my sessions: Select a folder, open it when it's not open, and scroll it into view at the top of the arrangement window.

    Are you seeing an error?

    What happens when you run this script?

    Almost everything happens the way I like it, but I can't get the track to be located at the top of my arrangement window. Sometimes the folder track is all the way at the bottom and I can't see the tracks inside it.

    I found a few slightly similar forum threads, but they all had to do with mapping to a controller and not with getting the tracks at the top of the arrangement window.

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "I've got a small script that I want to use to navigate my sessions: Select a folder, open it when it's not open, and scroll it into view at the top of the arrangement window. \n",
        "inputIsError": false,
        "inputWhatHappens": "Almost everything happens the way I like it, but I can't get the track to be located at the top of my arrangement window. Sometimes the folder track is all the way at the bottom and I can't see the tracks inside it. \n\nI found a few slightly similar forum threads, but they all had to do with mapping to a controller and not with getting the tracks at the top of the arrangement window. ",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 5,
        "inputTitle": "Scroll into View at top of arrangement window. "
    }

    Source

    //Activate Pro Tools
    sf.ui.proTools.appActivate();
    sf.ui.proTools.invalidate()
    
    //Open and scroll folder into view
    sf.ui.proTools.trackGetByName({ name: "ƒ Drums", makeVisible: true }).track.folderTrackSetOpen({targetValue: 'Enable',});
    sf.ui.proTools.trackGetByName({ name: "ƒ Drums"}).track.trackScrollToView();
    
    

    Links

    User UID: MIAuzc2vcCYxka43HtDO1Nf4mrl2

    Feedback Key: sffeedback:MIAuzc2vcCYxka43HtDO1Nf4mrl2:-OCiA8_kljsDWTWzogOA

    Feedback ZIP: lxPK2UFFwurq+QR436SWcKABiSua4MfvT4ZY86pS9bt4wXIYZoMXWYsqzicAuLp8bgGiympSQtFKA1hXK1BsdOn3T0O5SByjG5w1RHqs11+oLb/4EePUrakiQ7RaXc02WQqtRv4znqZlvGaVdyywnR25XfsWPLgiM28iU4Ti/oCEa7I91xNrpUOjO5nHyS1bN7llEkyRnBL6a9w8KGZon7VURDq4e1w7qaAHeVAeYa5xN6vOkPXHVijsgVM6frDsvHj5CZKwht6FSVFj/SzXq8fKoDI/A4kI1b8by1ijUH7nNL3/GjICQknjdPe4UzkGvH5y1qFaEZ9TBjuK8z5ZFHGeaHuTxy+4cVaXwQyPhXw=

    • 1 replies
    1. This should do it - It uses the PT "Scroll to Track" to bring the selected folder to the top of the edit window. Just change the name of the constant at the top of the script to open other folders:

      const folderName = "ƒ Drums"
      
      /**
      * @param {string[] | string} trackName
      */
      function csScrollToTrack(trackName) {
          var confirmationDialogWin = sf.ui.proTools.confirmationDialog;
          var scrollTrack = (typeof trackName == "object") ? trackName[0] : trackName;
          try {
              sf.ui.proTools.menuClick({ menuPath: ['Track', 'Scroll to Track...'] });
              confirmationDialogWin.elementWaitFor({ timeout: 100 });
          } catch (err) {
              sf.keyboard.press({ keys: "n", repetitions: 2 });
              sf.ui.proTools.menuClick({ menuPath: ['Track', 'Scroll to Track...'] });
              confirmationDialogWin.elementWaitFor({}, `Could not find Scroll to track Dialog`);
          }
          confirmationDialogWin.textFields.first.elementSetTextFieldWithAreaValue({
              value: scrollTrack,
              useMouseKeyboard: true
          });
      
          confirmationDialogWin.buttons.whoseTitle.is('OK').first.elementClick();
      
          confirmationDialogWin.elementWaitFor({ waitType: 'Disappear' });
      };
      
      
      // Activate Pro Tools
      sf.ui.proTools.appActivate();
      sf.ui.proTools.invalidate()
      
      // Open folder 
      sf.ui.proTools.trackGetByName({ name: folderName, makeVisible: true }).track.folderTrackSetOpen({ targetValue: 'Enable', });
      
      // Scroll into view
      csScrollToTrack(folderName)