No internet connection
  1. Home
  2. Support

Clear muted clips makro not working in pro tools

By Jaim Sahuleka @Jaim_Sahuleka
    2025-05-12 18:31:00.601Z

    Title

    Clear muted clips makro not working in pro tools

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

    I can't get this script to work. I made a keyboard shortcut and press i while having pro tools open. Nothing happens. I am on Sonoma.

    Are you seeing an error?

    What happens when you run this script?

    Nothing happens. The cursor stays at the same location.

    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": "I can't get this script to work. I made a keyboard shortcut and press i while having pro tools open. Nothing happens. I am on Sonoma.",
        "inputIsError": false,
        "inputWhatHappens": "Nothing happens. The cursor stays at the same location.",
        "inputHowRun": {
            "key": "-Mpfwh4RkPLb2LPwjePT",
            "title": "I used a keyboard shortcut within the target app"
        },
        "inputImportance": 5,
        "inputTitle": "Clear muted clips makro not working in pro tools"
    }

    Source

    /* Script includes code from Oliver Momm, Christian Scheuer */
    
    // Function to set Pro Tools frontmost via AppleScript
    function setPTfrontmost() {
        sf.system.execAppleScript({
            script: 'tell application "System Events" to tell process "Pro Tools" to set frontmost to true'
        });
    }
    
    // Set Pro Tools frontmost
    setPTfrontmost();
    sf.wait({ intervalMs: 50 });
    
    // Check if track is selected, else stop script
    if (!sf.ui.proTools.getMenuItem('Track', 'Make Inactive').isEnabled) {
        throw 0;
    
    }
    else {
        // "Return" key to go to start of session
        sf.keyboard.press({
            keys: 'return'
        });
    
        // Select first clip
        sf.keyboard.press({
            keys: 'shift+tab'
        });
    
        // Repeat while audio is still selected
        while (true) {
            var info = sf.ui.proTools.selectionGetInfo();
            if (info.isEmpty)
                break;
    
            var segments = 1;
            var skipClip = true;
    
            if (!info.hasFullClip) {
                // We don't have a full clip yet
    
                if (info.hasEndFade && !info.hasPartialClip || info.isPureEmptySpace) {
                    // We're at an end fade or in pure empty space, just skip that and continue
                    sf.keyboard.press({
                        keys: 'tab, shift+tab'
                    });
    
                    continue;
                }
    
                // We only have a partial clip, maybe we stopped at a sync point or in a fade,
                // so keep extending the selection right until we have a full clip
                for (var i = 0; i < 2; i++) {
                    //Extend selection right
                    segments++;
                    sf.keyboard.press({
                        keys: 'shift+tab'
                    });
    
                    info = sf.ui.proTools.selectionGetInfo();
                    if (info.hasFullClip)
                        break;
                }
                if (!info.hasFullClip) {
                    // We couldn't get the full clip, likely reason is we have reached the end of the track
                    break;
                }
            }
    
            if (info.isClipMuted) {
                // Delete clip
                sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Clear'] });
                sf.keyboard.press({ keys: 'tab' });
                skipClip = false;
            }
    
            // Skip the current selection (unless it was deleted)
            if (skipClip)
                for (var i = 0; i < segments; i++)
                    sf.keyboard.press({ keys: 'tab' });
    
            // Select next clip
            sf.keyboard.press({ keys: 'shift+tab' });
        }
    
        log('Clear Muted Clips', 'All muted clips cleared from this track');
    }
    
    // Go to start of session
    sf.keyboard.press({
        keys: 'return'
    });
    

    Links

    User UID: QBoJNSFDiLgTl1WfZv6125A2pGW2

    Feedback Key: sffeedback:QBoJNSFDiLgTl1WfZv6125A2pGW2:-OQ4kvX9LVBtnS1QLXDh

    Feedback ZIP: a8Fe26F1sOk938wJUEaTariF4vukZGqtXurijFt004G7rDAiUczODV6XbagrAyYHWMRATMxFpYOa18OoV1GoIjIDWs5Rq84ZsleIWgOTFjikte2cGrUey1lS+SG7MWnwBHyK6UIUtkC181apKoi7gyhK4XbzyREH7yWa9EX/PIeg2A8bgz23ciXa534tbOtrOqYTBJdlRpx5u4/2xmHyr6lhos+DzB3DCeNgI0PIknaqOknsS9RGT86pFpyNW5NLzZxmCufA7QyLoCfv6Q4qwMA4PPxFqQ3mHYGjdT3mllJ1gjv6IFASqR9G2BxDrRlfFJy/Md6t3/WZyni271F7yHM4OcMlHFz4df6Vsz9OUrw=

    • 0 replies