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

Quantize Macro created for Pro Tools 2022 not working in 2024.

By T Francis @T_Francis
    2025-01-22 12:59:04.027Z

    Title

    Quantize Macro created for Pro Tools 2022 not working in 2024.

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

    Apply all relevant quantize values via a Stream Deck button

    Are you seeing an error?

    22.01.2025 12:55:40.48 [Backend]: !! Command Error: Quantize - 1/4 [user:cksud97an0000rl10ockpw05a:cl1dbswiw000d2b104wvtdv7f]: @Error invoking checkbox.set (Quantize - 1/4: Line 6) CheckBoxAction requires UIElement Couldn't get item #0 as the array's parent node wasn't found - sf.ui.app('com.avid.ProTools').windows.whoseTitle.is('Event Operations').first.checkBoxs (AxElementArrayIndexedItem)

    What happens when you run this script?

    This script was created for Pro Tools 2022 and now the interface has changed. I've tried reprogramming the script using the "pick" buttons to re-direct the commands to the relevant checkboxes & menus but I keep getting various errors regarding the checkboxes not working.

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "Apply all relevant quantize values via a Stream Deck button",
        "inputIsError": true,
        "inputError": "22.01.2025 12:55:40.48  [Backend]: !! Command Error: Quantize - 1/4 [user:cksud97an0000rl10ockpw05a:cl1dbswiw000d2b104wvtdv7f]:\n@Error invoking checkbox.set (Quantize - 1/4: Line 6)\n    CheckBoxAction requires UIElement\n    Couldn't get item #0 as the array's parent node wasn't found - sf.ui.app('com.avid.ProTools').windows.whoseTitle.is('Event Operations').first.checkBoxs (AxElementArrayIndexedItem)",
        "inputWhatHappens": "This script was created for Pro Tools 2022 and now the interface has changed. I've tried reprogramming the script using the \"pick\" buttons to re-direct the commands to the relevant checkboxes & menus but I keep getting various errors regarding the checkboxes not working.",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 5,
        "inputTitle": "Quantize Macro created for Pro Tools 2022 not working in 2024."
    }

    Source

    
    //Calling command "Quantize Window Open Scr" from package "CEM Decks"
    sf.soundflow.runCommand({
        commandId: 'package:cltznxtti0000l110hahd82jf',
        props: {}
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.checkBoxes.whoseTitle.is("Note Off").first.checkboxSet({
        targetValue: "Disable",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.popupButtons.whoseTitle.is("Combined Quantize").first.popupMenuSelect({
        menuPath: ["1/4 note"],
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.checkBoxes.whoseTitle.is("Tuplet:").first.checkboxSet({
        targetValue: "Disable",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.checkBoxes.whoseTitle.is("Offset grid by:").first.checkboxSet({
        targetValue: "Disable",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.checkBoxes.whoseTitle.is("Randomize:").first.checkboxSet({
        targetValue: "Disable",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.checkBoxes.whoseTitle.is("Swing:").first.checkboxSet({
        targetValue: "Disable",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.checkBoxes.whoseTitle.is("Include within:").first.checkboxSet({
        targetValue: "Disable",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.checkBoxes.whoseTitle.is("Exclude within:").first.checkboxSet({
        targetValue: "Disable",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.buttons.whoseTitle.is("Apply").first.elementClick();
    
    //Calling command "Quantize Window Toggle Scr" from package "CEM Decks"
    sf.soundflow.runCommand({
        commandId: 'package:cltznzfit0001l1108qhzsf5e',
        props: {}
    });
    
    
    

    Links

    User UID: IPoX41BJQfW8Jfm5DwC4SC8wDo33

    Feedback Key: sffeedback:IPoX41BJQfW8Jfm5DwC4SC8wDo33:-OHD53_wdxSPw3FrIlPt

    Feedback ZIP: AC21PoqkT6mDLQdiFWCLb7pzaX4Trp1RHc7GHTbLoSdx7GwjhBfWBTXWgR8BjpmaXumREaRxlXhI94pTzSdCYWu6WegJ3KPJFGQzCLxDfQIjZk4L+VbT46APWcP9lBDztY8Xr7gj7B1+7RvsEVQvX2582iYZmvYAdjZXz0IcNc0rky7zvRSymXVF6wqpxePBOhMZcuWbMf0oiN6MFblXGCFGeAM3WavQZDzuZWIdhd6P3YLihUTR2Y9mRkl31M00WAd5MFFC/OluN9oO81Kc8MG9WERkYpSmcLxcZjYY+lIzBC5NWQzWes1Pi28LGnaYVMlhUWuwOGtRtqrpaUTeBI1Jqh3C4Fe5dURv6kA1Ue8=

    • 1 replies
    1. Chris Shaw @Chris_Shaw2025-01-22 23:51:34.100Z2025-01-22 23:57:39.350Z

      Hey @T_Francis,

      The event operations window no longer has a title and some of the checkbox names have changed.
      I've refactored the script to make it easier to create different versions. Just change the values in the checkboxSettings object and quantizeGridValue at the top of the script.
      I noticed you didn't have a setting in your original script for "Note On" so I added that as well:

      const quantizeGridValue = "1/4 note"
      
      const checkBoxSettings = {
          "Note On": "Enable",
          "Note Off": "Disable",
          "Tuplet:": "Disable",
          "Offset:": "Disable",
          "Randomize:": "Disable",
          "Swing:": "Disable",
          "Include within:": "Disable",
          "Exclude within:": "Disable",
      }
      
      // Open Event operations window / quantize settings
      sf.ui.proTools.menuClick({
          menuPath: ["Event", "Event Operations", "Quantize..."],
          targetValue: "Enable"
      })
      
      // Define Quantize "Apply" button
      const quantizeApplyBtn = sf.ui.proTools.windows.first.buttons.whoseTitle.is("Apply").allItems[4];
      
      // Wait for the quantize "Apply" button to appear
      quantizeApplyBtn.elementWaitFor({ waitType: "Appear" })
      
      // Since the Event Operations window has no title, refer to it as the first focused window
      const eventOperationsWindow = sf.ui.proTools.focusedWindow
      
      // Set Quantize Grid
      eventOperationsWindow.popupButtons.whoseTitle.is("Combined Quantize").first.popupMenuSelect({
          menuPath: [quantizeGridValue],
      });
      
      // Set checkboxes
      for (const checkBox in checkBoxSettings) {
          eventOperationsWindow.checkBoxes.whoseTitle.is(checkBox).first.checkboxSet({
              targetValue: checkBoxSettings[checkBox],
          });
      }
      
      // Apply Quantize settings
      quantizeApplyBtn.elementClick()
      
      // Close Event Operations window
      sf.ui.proTools.menuClick({
          menuPath: ["Event", "Event Operations", "Event Operations Window"],
      })
      
      // Wait for window to close
      quantizeApplyBtn.elementWaitFor({
          waitType: "Disappear"
      })