No internet connection
  1. Home
  2. Support

Issues with Track Heights (Custom)

By Jordan Pascual @Jordan_Pascual
    2025-05-17 16:42:52.367Z

    Title

    Issues with Track Heights (Custom)

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

    Hello all!!I have a set of scripts I use ALL the time that is super useful to me for changing track heights, as I have them cued to a Streamdeck, as well as key commands for them. The scripts seem to be acting up recently and it's due to SF not being able to find the 'Track View' selector button as stated by the log.here is the error...Could not find Track View selector button (AxPtTrackDisplaySelectorButton)

    Are you seeing an error?

    What happens when you run this script?

    The script will not drag the track heights down/up as intended. Sometimes it will even crash upon instantiation!

    How were you running this script?

    I used a keyboard shortcut within the target app

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "Hello all!!I have a set of scripts I use ALL the time that is super useful to me for changing track heights, as I have them cued to a Streamdeck, as well as key commands for them. The scripts seem to be acting up recently and it's due to SF not being able to find the 'Track View' selector button as stated by the log.here is the error...Could not find Track View selector button (AxPtTrackDisplaySelectorButton)\n",
        "inputIsError": true,
        "inputWhatHappens": "The script will not drag the track heights down/up as intended. Sometimes it will even crash upon instantiation!",
        "inputHowRun": {
            "key": "-Mpfwh4RkPLb2LPwjePT",
            "title": "I used a keyboard shortcut within the target app"
        },
        "inputImportance": 5,
        "inputTitle": "Issues with Track Heights (Custom)"
    }

    Source

    function waitForPtToBeResponsive() {
        sf.waitFor({
            callback: () => sf.ui.proTools.getMenuItem('File', 'New...').isEnabled
        });
    }
    
    function changeTrackHeightWithMouse({ direction = 'down', trackHeightGridUnits = 1, }) {
        const trackHeightGridPixelsPerUnit = 15;
        const xOffset = 50;
    
        trackHeightGridUnits = Math.abs(trackHeightGridUnits);
        if (direction === "up") trackHeightGridUnits = -trackHeightGridUnits;
    
        const frame = sf.ui.proTools.selectedTrack.frame;
        const frameBottomLeft = frame.y + frame.h;
        const frameBottomTargetPositionY = frameBottomLeft + (trackHeightGridUnits * trackHeightGridPixelsPerUnit);
        const x = frame.x + xOffset;
        const endPosition = { x, y: frameBottomTargetPositionY };
    
        function doWithMouseAndRestorePosition({ action }) {
            const mousePosition = sf.mouse.getPosition().position;
            action();
            sf.mouse.setPosition({ position: mousePosition });
        }
    
        doWithMouseAndRestorePosition({
            action: () => {
                sf.mouse.down({ position: { x, y: frameBottomLeft } });
    
                sf.wait({ intervalMs: 250 }); // Increase time if it starts failing again
    
                sf.mouse.drag({ position: endPosition, });
    
                waitForPtToBeResponsive();
    
                sf.mouse.up({ position: endPosition });
    
                waitForPtToBeResponsive();
            }
        });
    }
    
    changeTrackHeightWithMouse({ ...event.props});
    

    Links

    User UID: qrvUEW8AGsfyOQAeE4NhmirsQvl1

    Feedback Key: sffeedback:qrvUEW8AGsfyOQAeE4NhmirsQvl1:-OQU77EkrKeR7t9-MwO7

    Feedback ZIP: uf3U84VyoSd+53phQjNdaUdcHEUcPQkVR9WJ10Wx80dlIomqJY0bhEEtCUm10t1gVrG0PY42MZvJYEX6dOjM2LoBqUmmm53QbP4ybVfjjYEv6V3v3VqqWLE7aD8kFjtFPLme0EurP77iYcm4ggYK8eAGaNCB4k73bepF5GNdnkWuVzmZdF0CBOzGd2SMU2pHX2hN9kOmTIVfcW6b0Brbpj1jgDKpktncdpwJnC7ESCgOhhDVw3mFK/gawrhNg973DTC7BZZPtdEQigrHMUj/COElXN6i8dCr0WRQTigh8Z4BP52fPDcthMisBYIvoGoAELorx8igy/XsPAX/8aa4ANtPu6Yp26E8qXZEit+n/bg=

    • 11 replies

    There are 11 replies. Estimated reading time: 11 minutes

    1. Jordan Pascual @Jordan_Pascual
        2025-05-20 18:00:20.788Z

        @Kitch Hey man! Just tagging you on this!

        Also here is an older thread with info when it used to work!

        1. In reply toJordan_Pascual:
          Kitch Membery @Kitch2025-05-20 18:08:09.726Z

          Hi @Jordan_Pascual

          Thanks for posting...

          As a first troubleshooting step, can I get you to update to the latest version of SoundFlow (SoundFlow 5.10.5) from soundflow.org/account/install.

          Let me know after doing so if the issue persists. :-)

          1. Jordan Pascual @Jordan_Pascual
              2025-05-20 18:33:25.153Z

              Yes sir!

              Updated, issue still persists, here's a screengrab! I found out it works once every blue moon, but super inconsistent. If there's a better way of approaching this please let me know!! :)

            • In reply toJordan_Pascual:
              Kitch Membery @Kitch2025-05-20 18:59:11.535Z2025-05-20 19:10:34.387Z

              Hi @Jordan_Pascual,

              Can you give this.

              I've added code to activate Pro Tools's main window and invalidate the main window as the tracks element properties may have changed since the last time it was run.

              sf.ui.proTools.appActivateMainWindow()
              sf.ui.proTools.mainWindow.invalidate();
              
              function waitForPtToBeResponsive() {
                  sf.waitFor({
                      callback: () => sf.ui.proTools.getMenuItem('File', 'New...').isEnabled
                  });
              }
              
              function changeTrackHeightWithMouse({ direction = 'down', trackHeightGridUnits = 1, }) {
                  const trackHeightGridPixelsPerUnit = 15;
                  const xOffset = 50;
              
                  trackHeightGridUnits = Math.abs(trackHeightGridUnits);
                  if (direction === "up") trackHeightGridUnits = -trackHeightGridUnits;
              
                  const frame = sf.ui.proTools.selectedTrack.frame;
                  const frameBottomLeft = frame.y + frame.h;
                  const frameBottomTargetPositionY = frameBottomLeft + (trackHeightGridUnits * trackHeightGridPixelsPerUnit);
                  const x = frame.x + xOffset;
                  const endPosition = { x, y: frameBottomTargetPositionY };
              
                  function doWithMouseAndRestorePosition({ action }) {
                      const mousePosition = sf.mouse.getPosition().position;
                      action();
                      sf.mouse.setPosition({ position: mousePosition });
                  }
              
                  doWithMouseAndRestorePosition({
                      action: () => {
                          sf.mouse.down({ position: { x, y: frameBottomLeft } });
              
                          //sf.wait({ intervalMs: 250 }); // Increase time if it starts failing again
              
                          sf.mouse.drag({ position: endPosition, });
              
                          waitForPtToBeResponsive();
              
                          sf.mouse.up({ position: endPosition });
              
                          waitForPtToBeResponsive();
                      }
                  });
              }
              
              changeTrackHeightWithMouse({ ...event.props});
              

              Please note that using Mouse simulation is the least reliable way to automate with SoundFlow.

              I can't guarantee my changes will fix the issue, so let me know how it runs for you, and I'll dig deeper. There is one more thing that I can try.

              1. Jordan Pascual @Jordan_Pascual
                  2025-05-20 19:40:58.440Z

                  Hey again @Kitch

                  Unfortunately, my results are about the same, with the modifications being a bit more reliable, but only about 50% of the time. I noticed you 'commented' Line 33 bypassing it, is that not needed possibly?

                  I may DM you as well since we can't discuss Beta testing elements on other forums, however, I know that this script is still not working as of 2024.10.2, the latest public release ;)

                  1. Kitch Membery @Kitch2025-05-20 20:05:36.646Z

                    Hi @Jordan_Pascual,

                    I just rewatched your video and now see where the issue is stemming from. Can I get you to share the track heights script?

                    1. Jordan Pascual @Jordan_Pascual
                        2025-05-20 20:07:55.480Z

                        100% Here it is!!

                        
                        sf.ui.proTools.appActivate();
                        
                        var size = [event.props.trackSize];
                        
                        if (globalState.csTrackSize == undefined) { globalState.csTrackSize = 1 };
                        globalState.csTrackSize++;
                        
                        if (globalState.csTrackSize >= size.length) { globalState.csTrackSize = 0 };
                        
                        try {
                            var f = sf.ui.proTools.selectedTrack.frame;
                            var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
                                relativePosition: { x: f.w / 2 - 5, y: 0 },
                                isOption: true,
                                isShift: true,
                            }).popupMenu;
                            popupMenu.menuClickPopupMenu({
                                menuPath: [size[globalState.csTrackSize]]
                            });
                        } catch (err) { };
                        
                        1. Kitch Membery @Kitch2025-05-20 20:33:20.092Z

                          Hi @Jordan_Pascual

                          Due to the way you're using globalState in this script, I'm not sure if I can reliably test this, but please give this script a try.

                          sf.ui.proTools.appActivate();
                          
                          const size = [event.props.trackSize];
                          
                          if (globalState.csTrackSize == undefined) {
                              globalState.csTrackSize = 1
                          }
                          
                          globalState.csTrackSize++;
                          
                          if (globalState.csTrackSize >= size.length) {
                              globalState.csTrackSize = 0
                          }
                          
                          try {
                              var f = sf.ui.proTools.selectedTrack.frame;
                          
                              var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
                                  relativePosition: { x: f.w / 2 - 5, y: 0 }, // Click near center of the track
                                  isOption: true,
                                  isShift: true,
                              }).popupMenu;
                          
                              popupMenu.menuClickPopupMenu({
                                  menuPath: [size[globalState.csTrackSize]]
                              });
                          
                              // Wait for the Popup Menu to no-longer have children in turn confirming that the menu has closed.
                              sf.waitFor({
                                  callback: () => !popupMenu.invalidate().children.first.exists,
                                  timeout: 2000,
                              }, `Failed waiting for the "track size" popup menu to close`);
                          
                          } catch (err) {
                              // Silently ignore any errors
                          }
                          

                          Due to changes that Apple made in Sonoma OS, popup menu calls are no longer synchronous. So for these situations, you'd need to implement a waitFor() method with a callback to ensure that each popup menu closes before moving on.

                          Again, this is untested, but it should do the trick.

                          1. Jordan Pascual @Jordan_Pascual
                              2025-05-20 20:59:38.922Z

                              Hey again @Kitch !

                              At first, the script wasn't working, but then I added back the "wait" command in the earlier script (for 250ms), and now it works amazing!!!

                              I DM'd you on Instagram for this, but the last thing I may need a little help on is a large combination script, that checks playlists, and utilizes this script... Let me know what would be the best way to take a look at that since it involves 'beta' issues :)

                              1. Kitch Membery @Kitch2025-05-20 21:09:06.230Z

                                That's great! I'm glad the added waitFor fixed it. :-)

                                I prefer to keep my Instagram for personal use if that's ok. Things get a little out of hand if I start using my social media accounts for SoundFlow-related communications.

                                Are the issues directly related to changes in new beta builds, or can this be tested in 2024.10.2? If they are, please reach out to support@soundlfow.org, and we can continue our discussions there.

                                1. Jordan Pascual @Jordan_Pascual
                                    2025-05-20 22:10:24.309Z

                                    Oh totally dude, smart to NOT use your personal socials for work stuff :

                                    There are two different issues, one on beta builds, as well as one that occurs in 2024.10.2, I'll go ahead and email what I texted you to that email, and I'm sure Christian/you could help out :)

                                    Thanks so much!