ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Renaming items with scripts

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
vahab san
Renaming items with scripts
on Nov 5, 2018 at 7:06:04 pm

Hello everyone

Here is the situation:
- I have an expression in comp A referring to comp B;
- If I change the name of comp B from the project panel manually, expressions will update automatically;
- If I change the name of comp B from the project panel by scripts, expressions will not update.

How can I rename the comp B with script and expressions update automatically?

Cheers


Return to posts index

Walter Soyka
Re: Renaming items with scripts
on Nov 5, 2018 at 8:23:28 pm

Try it like this:

var originalCompName = "Comp B";
var newCompName = "Comp C";

myComp.name = newCompName;
app.project.autoFixExpressions(originalCompName, newCompName);


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Walter Soyka
Re: Renaming items with scripts
on Nov 5, 2018 at 8:57:20 pm

And to clarify what it does... autoFixExpressions(oldText, newText) will identify all broken expressions, do a search and replace within them (swapping out oldText for newText), and committing that change if it fixes the break.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index


vahab san
Re: Renaming items with scripts
on Nov 6, 2018 at 8:07:34 am

Walter

Thank you very much.
Worked perfectly. And again thank you for the explanation.


Return to posts index

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