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

Track Scroll to View / Scroll Into View help!

By Robert Mallory @Robert_Mallory
    2024-01-18 21:42:22.584Z

    Title

    Track Scroll to View / Scroll Into View help!

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

    Hi! Many thanks in advance. My goal is to program a Macro that automatically does what happens in PT when I Right-Click on any track and then select "Scroll Into View" - which sets that selected track as the first fader on a control surface, and also scrolls it up to the first displayed track in the Edit or Mix window.

    There's a Macro in the PT default package called Track Scroll to View which I thought might do this exact thing, but I can't get it to work. Any help would be immensely appreciated.

    Are you seeing an error?

    What happens when you run this script?

    I'm using the Track Scroll to View macro - which I believe is from the default PT package - and I have it set to First Selected Track. When I run it however, nothing happens. I'm assuming it should do the same thing as when I right-click on a track and click Scroll Into View, but it's not actually doing anything as far as I can tell. No error message, just nothing.

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "Hi! Many thanks in advance. My goal is to program a Macro that automatically does what happens in PT when I Right-Click on any track  and then select \"Scroll Into View\" - which sets that selected track as the first fader on a control surface, and also scrolls it up to the first displayed track in the Edit or Mix window.\n\nThere's a Macro in the PT default package called Track Scroll to View which I thought might do this exact thing, but I can't get it to work. Any help would be immensely appreciated.",
        "inputIsError": false,
        "inputWhatHappens": "I'm using the Track Scroll to View macro - which I believe is from the default PT package - and I have it set to First Selected Track.  When I run it however, nothing happens.  I'm assuming it should do the same thing as when I right-click on a track and click Scroll Into View, but it's not actually doing anything as far as I can tell. No error message, just nothing.",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 5,
        "inputTitle": "Track Scroll to View / Scroll Into View help!"
    }

    Source

    //Macro converted to script
    
    
    sf.ui.proTools.selectedTrack.trackScrollToView();
    
    
    

    Links

    User UID: 5svVXseoIfPKaMpm3m4qSBTJsF43

    Feedback Key: sffeedback:5svVXseoIfPKaMpm3m4qSBTJsF43:-NoTWajx5J0z_u3F88oE

    Feedback ZIP: RCud/nxVwsWYozt2s7A2VsF4YkNUi++zKvjipkFocDujYARoX1YsvsyQe2PLURi+0EiJv3DwjtJidFYafZwzDDv6V8QHpO37VZZsTV5knvbKHwh1fL8DdAgLaxJLy+jwr20JjFaUW+aBzNn727oFSe9w7hbF0sfZbV4L31wXmF5hxVCez5+izr7Ukuk4l1VnDxh7CjC2dsoXA7MwarlSNBBTmiSjRh2n/MaYc0plEYmj4uIG6nT5Mg7vJtO+3osAVO41Kjc976R75rn0y5bH4zmpHg8rZ7pWHqpkhA8FRUHyWQQKtsl85Ofze5rx3KjIs64Cj163YMSgWazVOwiQp7RS9BN8YXQEAwWyokBOkVY=

    • 5 replies
    1. trackScrollToView doesn't scroll the track to the top of the edit window - it just insures that the selected track is visible in the edit window by scrolling the selected track into view.

      I use this to scroll the track to the top of the edit window and bank my S1.
      It's a bit overkill (lots of error correction) but it will bank to the first selected track or the first track of multiple selected tracks. I have it assigned to one of my S1 color keys.

      /**
      * @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' });
      
          sf.ui.proTools.trackSelectByName({
              names: (typeof tracksToScrollTo == "object") ? tracksToScrollTo : [tracksToScrollTo]
          });
      };
      
      // MAIN //
      
      if (sf.ui.proTools.selectedTrackCount == 0) {
          sf.interaction.notify({ title: "Scroll to track", message: "No Tracks Selected" })
          throw 0
      }
      const tracksToScrollTo = sf.ui.proTools.selectedTrackNames
      
      csScrollToTrack(tracksToScrollTo);
      
      1. also, be sure that "Scroll to Track" Banks Controllers is enabled in PT Preferences > Mixing > Controllers:

      2. R
        In reply toRobert_Mallory:
        Robert Mallory @Robert_Mallory
          2024-01-19 16:25:11.412Z2024-01-19 19:52:03.951Z

          Thanks so much Chris! I ended up finding some script elsewhere on the forum that also does the Scroll Into View trick. I can't take any credit for it but check it out if you like:

          
          /**@param {string} trackName */
          function ptScrollToTrack(trackName) {
              sf.ui.proTools.menuClick({ menuPath: ['Track', 'Scroll to Track...'] });
          
              sf.ui.proTools.confirmationDialog.elementWaitFor();
          
              sf.ui.proTools.confirmationDialog.textFields.first.elementSetTextFieldWithAreaValue({
                  value: trackName
              });
          
              sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('OK').first.elementClick();
          
              sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear' });
          };
          
          sf.ui.proTools.appActivateMainWindow();
          sf.ui.proTools.mainWindow.invalidate();
          
          // Get selected track name
          const selectedTrackName = sf.ui.proTools.selectedTrack.normalizedTrackName;
          
          
          
          
          // Scroll to Track
          ptScrollToTrack(selectedTrackName);
          
          
          1. Glad you found a solution.
            Just for future reference - this is how to quote code in the forum so that it is properly formated:
            How to quote code in the SoundFlow forum.

            1. RRobert Mallory @Robert_Mallory
                2024-01-19 19:52:40.321Z

                Thanks for sharing Chris; fixed it!