No internet connection
  1. Home
  2. How to

Enabling the Quantize window in Pro Tools is Toggling, not enabling.

By T Francis @T_Francis
    2024-03-20 11:34:53.239Z

    Hi there,

    I'm using this piece of script to enable the Quantize window in Pro Tools:

    sf.ui.proTools.menuClick({
    menuPath: ["Event", "Event Operations", "Quantize..."],
    targetValue: 'Enable'
    }); >

    However, rather than hard-enabling it, it's just toggling it. Which is a problem if the window is already open as the function toggles it closed before running any attached scripts. Am I invoking this window correctly, or is this a PT issue?

    Many Thanks!

    Trystan

    Solved in post #9, click to view
    • 9 replies
    1. T
      T Francis @T_Francis
        2024-03-20 11:47:47.028Z

        By the way, this seems to be happening with any invocation of the Quantize window, including the packaged "Event Menu: Event - Quantize" macro in Soundflow. Regardless of wether the buttons are set to Enable, Disable or Toggle, the window will only toggle.

        1. I looked into this. The targetValue: 'Enable' option is designed to allow you to click a menu item that isn't "checked". In this case, Pro Tools apparently doesn't make that menu item "checked" when the window is open, which is why you're seeing this problem.

          You can do something like this instead to make sure the window is open:

          
          
          if (!sf.ui.proTools.windows.some(w => w.children.whoseRole.is("AXStaticText").whoseValue.is("Quantize").first.exists)) {
              sf.ui.proTools.menuClick({
                  menuPath: ["Event", "Event Operations", "Quantize..."],
              });
          }
          
          1. TT Francis @T_Francis
              2024-03-20 16:06:56.354Z

              Thanks Christian,

              If I take your script as verbatim and add it to a button on the stream deck, it still just toggles the window open and closed. Should I be using it in a different way?

              Just to make sure my intent is clear, I want that piece of script to sit at the top of my various quantize macros and open the quantize window if it's closed, but leave it open if it's already open. Currently this is closing the window if it's already open.

              Thanks for your continued help!

              Trystan

              1. Hm, that's odd, but it's probably because that window is appearing differently on your version of Pro Tools. What version are you running?

                This script works to ensure the window is open (and not close it) on PT 2024.3

                1. TT Francis @T_Francis
                    2024-03-20 16:18:36.132Z

                    Currently 2022.12.0 - basically we don't like to do updates mid-project and...we've not yet had that luxury!!

                    T

                    1. Gotcha. In 2022.12, it's a bit simpler:

                      
                      
                      if (!sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.exists) {
                          sf.ui.proTools.menuClick({
                              menuPath: ["Event", "Event Operations", "Quantize..."],
                          });
                      }
                      
                      ReplySolution
                      1. TT Francis @T_Francis
                          2024-03-20 16:32:07.702Z

                          That's the ducky!

                          Brilliant. And now I also have the most up to date code for when we do finally update!

                          Thanks again for your help, Christian!

              2. In reply toT_Francis:

                Hi T,

                I'll take a look at this. Please see here for how to quote code on the forum:

                1. TT Francis @T_Francis
                    2024-03-20 16:00:07.987Z

                    Thankyou for that -

                    I Shall Do This in the future!