Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Create Masks From Text on Multiple Layers

  • Create Masks From Text on Multiple Layers

    Posted by Jonathan Young on March 22, 2019 at 3:27 pm

    Hello, I’m looking for a way to use the “Create Masks form Text” option on multiple text layers at once. I have hundreds of text layers that I need to apply this to and I can only apply it to one at a time… Any ideas?

    Jonathan Young replied 7 years, 5 months ago 2 Members · 4 Replies
  • 4 Replies
  • Andrei Popa

    March 25, 2019 at 8:07 am

    Select your desired layers and then run this script.


    app.beginUndoGroup('Create Shapes From Multiple Texts');
    var myComp = app.project.activeItem;
    var selectedLayers = myComp.selectedLayers;
    for (var i = 0; i < selectedLayers.length; i++){
    deselectEverything(myComp);
    selectedLayers[i].selected = true;
    createMasksFromText(selectedLayers[i]);
    }
    app.endUndoGroup();

    function createMasksFromText(myLayer){
    if(myLayer.sourceText != null){
    app.executeCommand(3781);
    }else{
    alert(myLayer.name + " is not a text layer.")
    }
    }

    function deselectEverything(myActiveComp) {
    mySelectedItems = myActiveComp.selectedLayers;
    for (var i = 0; i < mySelectedItems.length; i++){
    mySelectedItems[i].selected = false;
    }
    }

    Andrei
    My Envato portfolio.

  • Jonathan Young

    March 25, 2019 at 6:30 pm

    Thanks Andre, appreciate all your help with this!

    It seems like that is creating shape layer, the same as the menu item “Create shapes from text” instead of achieving the same effect as the menu item “create masks from text”… Do you have any idea on how to fix that?

  • Andrei Popa

    March 27, 2019 at 8:43 am

    I’m sorry i respond this late, been quite busy lately. Yes, i have a solution. Replace “app.executeCommand(3781);” with “app.executeCommand(2933);”. If you wonder where i got that id number, here is a link to a pdf that provides all menu ids.

    Andrei
    My Envato portfolio.

  • Jonathan Young

    March 29, 2019 at 2:29 am

    Awesome! Works great. Thanks so much!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy