How I can change part of my expression using JavaScript ?

Community Beginner ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

When I extracting Duik controllers to the other composition. it creates an expressions on controllers into composition with all my rigged character, and thats some issues when After Effect can lose name of composition in expression when I rename my comp, thats sample:

//Duik.link
var link = comp("Comp 1").layer("B_HEAD").transform.position;
var timeLayer = comp("Comp 1").layer("Boss_1");
var timeOffset = timeLayer.startTime;
link.valueAtTime(time + timeOffset);

If I want to rename my comp, AE show an error thats he can`t find composition and expression is doesnt work

I want to write a Script that can help me change this part of my expression and place the correct composition name 

TOPICS
Expressions , How to , Scripting

Views

51

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Aug 03, 2022 Aug 03, 2022

Say you chage the name of "Comp 1" to "New Comp Name". Your script might be as simple as this:

 

 

app.project.autoFixExpressions("Comp 1", "New Comp Name");

 

 

Likes

Translate

Translate
Adobe Community Professional ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Say you chage the name of "Comp 1" to "New Comp Name". Your script might be as simple as this:

 

 

app.project.autoFixExpressions("Comp 1", "New Comp Name");

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

It works! Thank you! 
But can I using this method automatically found where Script should changing text? I found this line

app.project.activeItem.propertySpec.expression

Is this what I want? Cuz I cant understand how this line works 😞 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

I'm not sure what you're asking, but I don't think you'd use .propertySpec, which is just shorthand notation for the the actual path to a property, like .property("Position"), without specifying a layer.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

LATEST

Fine, I understand, thank your very much for helping!!! 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines