Mass "Remove Masks" script?

What type of scripts do you need?

Moderator: byronnash

Post Reply
Posts: 68
Joined: February 16th, 2009, 12:41 pm

August 11th, 2016, 11:06 am

Since there isn't a keyboard shortcut for Remove Mask, anyone know of a script that can remove all Masks from selected layers?

I've inherited a messy comp with lots duplicated layers that have many unused masks.
Posts: 80
Joined: November 27th, 2012, 6:41 am

August 11th, 2016, 1:49 pm

You can try this, it removes all masks blindly (save as .jsx in the ScriptUIPanel folder, restart AE, then launch from the Window menu):

Code: Select all

this.add("button{text: 'remove all masks'}").onClick = function(){
    var comp = app.project.activeItem;
    if (!comp || comp.typeName !== "Composition" || comp.selectedLayers.length<1){
        alert("No layer selected");
        var sel = comp.selectedLayers, N=sel.length, n, layer, numMasks;
        var removed = 0;
        app.beginUndoGroup("Remove All Masks");
        for (n=0; n<N; n++){
            layer = sel[n];
            if (!layer.mask) continue;
            numMasks = layer.mask.numProperties;
            removed += numMasks;
            while (numMasks>0) layer.mask(numMasks--).remove();
        alert("Removed " + removed + " masks on " + N + " layers");

Posts: 14
Joined: March 25th, 2011, 9:15 am

August 20th, 2016, 1:32 am

You can also use my much-neglected "Mask Selection Helper" script on It allows you to select all or some masks based on index or name matching. After selecting, you have to close the script window, then hit delete and the selected masks (even if they're not revealed) are deleted.
Post Reply