ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Create Masks From Text on Multiple Layers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jonathan Young
Create Masks From Text on Multiple Layers
on Mar 22, 2019 at 3:27:41 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?


Return to posts index

Andrei Popa
Re: Create Masks From Text on Multiple Layers
on Mar 25, 2019 at 8:07:49 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.


Return to posts index

Jonathan Young
Re: Create Masks From Text on Multiple Layers
on Mar 25, 2019 at 6:30:17 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?


Return to posts index


Andrei Popa
Re: Create Masks From Text on Multiple Layers
on Mar 27, 2019 at 8:43:46 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.


Return to posts index

Jonathan Young
Re: Create Masks From Text on Multiple Layers
on Mar 29, 2019 at 2:29:50 am

Awesome! Works great. Thanks so much!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]