ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

expression for the selected property

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sergei Tabalov
expression for the selected property
on Jun 25, 2018 at 2:49:57 pm

Good day.

There are two edittext fields in the script. First (tempScript) contains expression template and the second (fieldGetProp) contains selected any property as a variable. I have a problem with the second one.

var comp = app.project.activeItem;
var selLayers = comp.selectedLayers;

for (i = 0; i < selLayers.length; i++) {
selLayers[i](fieldGetProp.text).expression = tempScript.text;

I can get any selected property from any layer in the form of ("Transform")("Opacity") if it is opacity for example, or ("Effects")("Fill")("Color") if it is Fill effect, etc. So finally in the code it must be like this:
selLayers[i]("Transform")("Opacity").expression = tempScript.text;
but I can't find a way to paste this variable into the code without a dot after selLayer[i]
I tried to use this construction:
var tempPath = 'comp("' + + '").layer(' + selLayers[i].index + ')' + fieldGetProp.text;
and even $.writeln(tempPath); shows in the console that path is correct, but it does not work.

Thanks you for any advise

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved