ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Converting text layers into masks inside a script.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Scott Livingston
Converting text layers into masks inside a script.
on Mar 30, 2010 at 8:02:41 am

I'm trying to create a script that essentially does the same thing as right-clicking a text layer and clicking "Create Masks from Text". I would like to do this in a script because I have to do this multiple times on text layers in different compositions. I also have to add a Stroke effect to the generated masks and animate it differently for each layer. I'm wondering how I accomplish that in a script. I couldn't find anything in the scripting guide that showed how to do this. It may not even be possible but I figured that if it was, someone here could tell me how :) Thanks in advance!

PS: If this is the wrong forum I am very sorry, I could not find a After Effects Scripting forum and thought that this was the closest thing.


Return to posts index

Dan Ebberts
Re: Converting text layers into masks inside a script.
on Mar 30, 2010 at 3:18:27 pm

This seems to work:

var myCommandId = app.findMenuCommandId("Create Masks from Text");
app.executeCommand(myCommandId);



Dan



Return to posts index

Scott Livingston
Re: Converting text layers into masks inside a script.
on Mar 30, 2010 at 6:28:20 pm

Wonderful! Thanks a ton, if I may ask, where did you find that command? I don't see it in the scripting guide but I have a feeling there are lots of things that are not included in that.


Return to posts index


Dan Ebberts
Re: Converting text layers into masks inside a script.
on Mar 30, 2010 at 7:30:05 pm

I think it's undocumented and I believe it was revealed in a post by the Adobe engineer that implemented scripting. Hard to say what else is in there. :-)


Dan



Return to posts index

Mike Murtha
Re: Converting text layers into masks inside a script.
on Apr 25, 2012 at 7:20:52 am

Is there a way to do this moving all the way through the project? For instance, I have a mac workstation and a pc farm. Because certain fonts don't work on the farm, I need to outline all of the text in each composition of my current project.

I am thinking something like this

for(i=1;i<number of comps; i++){
for(o=1;o<number of layers in comp; o++){
if (o is instanceOf TextLayer){
var myCommandId = app.findMenuCommandId("Create Masks from Text");
app.executeCommand(myCommandId);
}
}


Return to posts index

Dan Ebberts
Re: Converting text layers into masks inside a script.
on Apr 25, 2012 at 5:24:39 pm

In theory, something like that should work (although your outer loop would be searching through the project items looking for comps), but you might need AE CS6 because I think the comp will need to have focus for the menu command to work.

Dan



Return to posts index


Mike Murtha
Re: Converting text layers into masks inside a script.
on Apr 26, 2012 at 12:15:02 am

Yeah it seems like there is no way to actually for AE to select each layer then run the command. Are you saying that Cs6 may fix this?


Return to posts index

Dan Ebberts
Re: Converting text layers into masks inside a script.
on Apr 26, 2012 at 12:45:31 am

One of the (very cool) CS6 scripting enhancements is control of the comp, footage, and layer viewers, which is the key piece to being able to solve your problem.

Dan



Return to posts index

Josiah Stewart
Re: Converting text layers into masks inside a script.
on May 8, 2019 at 11:09:09 pm

Hey,

Not sure how to fix this error but when I run that script, I get an "app is not defined".

Is this due to the changes in the script language? and if so would you know a fix to this?

Thanks

var myCommandId = app.findMenuCommandId("Create Masks from Text");
app.executeCommand(myCommandId);


Return to posts index


Dan Ebberts
Re: Converting text layers into masks inside a script.
on May 8, 2019 at 11:17:23 pm

How are you running the script? It doesn't sound like the script is targeting After Effects.

Dan



Return to posts index

Dan Ebberts
Re: Converting text layers into masks inside a script.
on May 8, 2019 at 11:26:25 pm

I think you'd get that error if you tried to use that script as an expression. Is that what happened? If so, try running it as a script, from the File > Scripts > Run Script File menu, or from the ExtendScript Toolkit Editor.


Dan



Return to posts index

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