Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is it possible to make a script that applies an expression to a parameter?

  • Is it possible to make a script that applies an expression to a parameter?

    Posted by Al Bran on May 21, 2019 at 9:10 pm

    I’m new to scripting for AE and I have a pretty limited programming knowledge, so it might not be worth your time to help with this. I appreciate any info or resources given. I want to make a script that will seek out a parameter (color, stroke width, ect) and apply an expression to it. It seems like it shouldn’t be too complicated, but I can’t find examples or tutorials doing something similar and I’m not knowledgeable enough to know if it’s more complicated than it seems. Using stroke width as an example, I would want the script to seek all stroke widths in whatever group is in the selected layer and then apply the same expression to all of them. Is it even possible to dig into a layer, find all its strokes, and apply an expression to the multiple stroke widths in a layer?

    Thanks again for any help or direction.

    Al Bran replied 7 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Tomas Bumbulevičius

    May 22, 2019 at 3:00 am

    Hey Al,

    welcome to the idea of scripting world! To begin with, this is as simple as:


    [propertyPath].expression = "expression goes here";

    Which, in full scripting language would look something like this:
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Graphic - Stroke").property("ADBE Vector Stroke Width").expression = "time*5"

    Now with further digging into this – you would need to do the following:
    1. Select the layer to process.
    2. Run FOR loop to skim through shape’s contents, to find out which has strokes, etc.
    3. Apply expressions to the ones which does.

    To make your life a lot easier, download this script called GimmePropPath. Run the script, select property you want to access and hit ‘Get Property Path’. This will give you a sense how to reach items and from that point, it will be easier.

    BUT, you still need to understand the whole hierarchy of items through scripting. So take this shortcut as a helper, not a full lead 🙂

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Al Bran

    May 22, 2019 at 3:55 pm

    Thank you, Tomas! Your help and direction is extremely helpful and much appreciated. You’ve given me plenty to go off of:)

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