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

Track Height selection not working with PT 2024.3

By Mike Wax @mikewax
    2024-03-22 01:57:42.556Z

    Title

    Track Height selection not working with PT 2024.3

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

    Looking to change the track height of the selected track to a specific height. When i run it, i expect it to show the track height menu and select the correct height from the popup menu.

    Are you seeing an error?

    Popup menu was not found (TEST: Line 10) Popup window was not found after waiting 2000 ms

    What happens when you run this script?

    when i run the script i just get the error and the menu is not showing up. I've tried messing with different numbers for the relative Y position, but can't seem to get it to work.

    How were you running this script?

    I clicked the "Run Script" or "Run Macro" button in SoundFlow

    How important is this issue to you?

    4

    Details

    {
        "inputExpected": "Looking to change the track height of the selected track to a specific height. When i run it, i expect it to show the track height menu and select the correct height from the popup menu. ",
        "inputIsError": true,
        "inputError": "Popup menu was not found (TEST: Line 10)\nPopup window was not found after waiting 2000 ms",
        "inputWhatHappens": "when i run the script i just get the error and the menu is not showing up. I've tried messing with different numbers for the relative Y position, but can't seem to get it to work.",
        "inputHowRun": {
            "key": "-MpfwYA4I6GGlXgvp5j1",
            "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow"
        },
        "inputImportance": 4,
        "inputTitle": "Track Height selection not working with PT 2024.3"
    }

    Source

    
    
    sf.ui.proTools.appActivate();
    
    var size = "small";
    
    var f = sf.ui.proTools.selectedTrack.frame;
    
    var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
        relativePosition: { 
            x : f.w - 10,
            y : 5 },
        isRightClick: true
    }).popupMenu;
    
    popupMenu.menuClickPopupMenu({
        menuPath: [size]
    });
    

    Links

    User UID: HpKeItbsbJg4ClzkyDuBUiDd8mm2

    Feedback Key: sffeedback:HpKeItbsbJg4ClzkyDuBUiDd8mm2:-NtYsCDQGEuw_cGsiBrl

    Feedback ZIP: A1CowpwjXnikiohEIT1qoRnVH7t4cZ26TXCJiCjfwFvnWVTRCbgf33TALiaPd9A5BMD33+5lnRkFMRyQBTqHStll94LL0lTnDCMm2q7nFM0b/Rau78ZLMkJ6yN+UA7rZgsnBs1h2kvBK1pPNCQrZanHd/+7tiSXJndsxD1LYVMRVPSK7KsniXAXz4nqGMqzFUF6CpRTsaP7R1uEGoM4z7gFjfIf9LibynV5opy+0rkyIpUUq1PQg2F9py5vFNhcy2jv4XAjnwaUIFPIMhPEKQBtqp5wqRVKlf/xvP/re3zT1slBRgfZajZL2VcvxkeBrRz7ItuKG8NuN83g1Xqk90RJRNl9r4PiYbLxkwTY/YG8=

    Solved in post #4, click to view
    • 4 replies
    1. Chris Shaw @Chris_Shaw2024-03-22 16:28:32.963Z2024-03-22 18:05:15.672Z

      Hey @Mikewax,

      Avid changed the clickable area of a bunch of elements in PT. To compensate SF now defaults to clicking elements using "MidCenter" as the anchor point instead of "TopLeft". This works for most UI elements but since the track height selector isn't it's own UI element and we click it by calculating from the left edge of the track header frame, we need to override the default anchor point by using the anchor property:

      sf.ui.proTools.appActivate();
      
      var size = "small";
      
      var f = sf.ui.proTools.selectedTrack.frame;
      
      var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
          anchor:"TopLeft", //<<<<<<<<<<<<<<
          relativePosition: { 
              x : f.w - 10,
              y : 5 },
          isRightClick: true
      }).popupMenu;
      
      popupMenu.menuClickPopupMenu({
          menuPath: [size]
      });
      
      1. Alternatively, you can leave the anchor point alone and divide the track width in half and add that to the default center anchor point x coordinate. There's no need to add an offset to the y coordinate since the click action is already in the center:

        sf.ui.proTools.appActivate();
        
        var size = "small";
        
        var f = sf.ui.proTools.selectedTrack.frame;
        
        var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
            relativePosition: { 
                x : f.w/2 - 10,
                y : 0 },
            isRightClick: true
        }).popupMenu;
        
        popupMenu.menuClickPopupMenu({
            menuPath: [size]
        });
        
        1. Chris Shaw @Chris_Shaw2024-03-22 16:47:42.235Z2024-03-22 18:06:22.966Z

          OR,

          As @chrscheuer pointed out on another thread, you don't have to use the frame width at all (f.w) and just use the "MidRight" anchor:

          sf.ui.proTools.appActivate();
          
          var size = "small";
          
          var f = sf.ui.proTools.selectedTrack.frame;
          
          var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
              anchor:"MidRight",
              relativePosition: { 
                  x : - 10,
                  y : 0 },
              isRightClick: true
          }).popupMenu;
          
          popupMenu.menuClickPopupMenu({
              menuPath: [size]
          });
          
          Reply1 LikeSolution
          1. Mike Wax @mikewax
              2024-03-22 17:53:22.519Z

              @Chris_Shaw You're my hero.

              I had no idea about the anchor property and it makes sense now knowing that SF changed the default to the Mid Center. It was driving me crazy trying to nail the pixel position because I was measuring everything from the Top Left position.

              I appreciate the help as always and thank you for the extra credit with the additional coding examples and explanations.
              I will get to work with these!!