ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Al Bran
Is it possible to make a script that applies an expression to a parameter?
on May 21, 2019 at 9:10:16 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.


Return to posts index

Tomas Bumbulevičius
Re: Is it possible to make a script that applies an expression to a parameter?
on May 22, 2019 at 3:00:54 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


Return to posts index

Al Bran
Re: Is it possible to make a script that applies an expression to a parameter?
on May 22, 2019 at 3:55:06 pm

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


Return to posts index

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