Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Converting text layers into masks inside a script.

  • Converting text layers into masks inside a script.

    Posted by Scott Livingston on March 30, 2010 at 8:02 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.

    Dan Ebberts replied 7 years, 3 months ago 4 Members · 10 Replies
  • 10 Replies
  • Dan Ebberts

    March 30, 2010 at 3:18 pm

    This seems to work:

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

    Dan

  • Scott Livingston

    March 30, 2010 at 6:28 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.

  • Dan Ebberts

    March 30, 2010 at 7:30 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

  • Mike Murtha

    April 25, 2012 at 7:20 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);
    }
    }

  • Dan Ebberts

    April 25, 2012 at 5:24 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

  • Mike Murtha

    April 26, 2012 at 12:15 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?

  • Dan Ebberts

    April 26, 2012 at 12:45 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

  • Josiah Stewart

    May 8, 2019 at 11: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);

  • Dan Ebberts

    May 8, 2019 at 11:17 pm

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

    Dan

  • Dan Ebberts

    May 8, 2019 at 11:26 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

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