No internet connection
  1. Home
  2. Script Sharing

Set & Clear the "Clips List" filter text field in Pro Tools 2024.6+

By Kitch Membery @Kitch2024-12-06 22:55:53.774Z

Hello, legends!!!

In Pro Tools 2024.6 there was a change made to the "Clips List" filtering functionality that may cause issues to existing scripts that use the old filtering functionality. So I've created a couple of functions and thought I'd share them.


Set a value in the "Clips List" filter.

Here is a reusable function for setting the filter value in the "Clips List" filter.

function setClipsListFilter(filterString) {
    sf.ui.proTools.appActivateMainWindow();

    // Get the Clips List filter text field.
    const clipListFilterTextField = sf.ui.proTools.mainWindow.textFields.find(
        tf => tf.getString("AXRoleDescription") === "edit text"
    );

    clipListFilterTextField.elementWaitFor();

    // If the filter text is already set, return out of the function.
    if(clipListFilterTextField.value.invalidate().value === filterString) return;

    // Get the "Clear Search Text" button (ie "X" button).
    const clipsFilterPlate = sf.ui.proTools.mainWindow.buttons.whoseTitle.is("Plate");
    const clearClipsFilterButton = clipsFilterPlate.allItems.whoseValue.is("Clear Search Text").first;

    if (clearClipsFilterButton.exists) {
        // Clear the text from the filter text field.
        clearClipsFilterButton.elementClick();
    }

    // Enter value into the filter text field
    clipListFilterTextField.elementSetTextFieldWithAreaValue({
        value: filterString,
        useMouseKeyboard: true
    }, `Failed typing "${filterString}" into the Clips List filter text field.`);

    // Wait for text to finish being entered.
    sf.waitFor({
        callback: () => clipListFilterTextField.value.invalidate().value === filterString,
        timeout: 2000,
    }, `Failed entering clip filter text: "${filterString}".`);

    // De-focus the "Clip List" filter text field by activating Pro Tools' main window.
    sf.ui.proTools.appActivateMainWindow();
}

You can then call the function from anywhere in your script like this...

setClipsListFilter("Enter Filter Text Here");

Clear the "Clips List" filter.

Here is a reusable function for clearing the "Clips List" filter.

function clearClipsListFilter() {
    const clipsFilterPlate = sf.ui.proTools.mainWindow.buttons.whoseTitle.is("Plate");
    const clearClipsFilterButton = clipsFilterPlate.allItems.whoseValue.is("Clear Search Text").first;

    if (clearClipsFilterButton.exists) {
        clearClipsFilterButton.elementClick({}, `Failed clearing the Clips List filter text field.`);
    }
}

You can then call the function from anywhere in your script like this...

clearClipsListFilter();

Please note... Each of these functions only needs to appear once in your script and can be called multiple times if required. :-)

  • 0 replies