-
After Effects Script problem with text layers
Hi, sorry it’s my first post, it’s not about expressions, but scripts, i hope, it’s ok.
So, I’ve got a script some parts work, some parts don’t work. There’s no errors, it runs but doesn’t do some parts.
I want to collect 6 text layers and want to store and manipulate theme in a JSON I post the generator loop and write in a comment – works or doesn’t work.
I’m new in AE, but I’m ok with javascript. I use the document of adobe for CS6, and I use CS6. Any ideas? thanks!
for (var layerNum = 0; layerNum < 6; layerNum += 1){
myTextLayers['word' + layerNum] = {};myTextLayers['word' + layerNum].layer = mainComp.layers.addText(); // works
myTextLayers['word' + layerNum].layer.name = 'word' + layerNum; // worksmyTextLayers['word' + layerNum].property = myTextLayers['word' + layerNum].layer.property('Source Text');
myTextLayers['word' + layerNum].value = myTextLayers['word' + layerNum].property.value;alert( myTextLayers['word' + layerNum].value); //empty
myTextLayers['word' + layerNum].value.text = 'my little text ' + layerNum; //works
myTextLayers['word' + layerNum].value.font = config.textSettings.font; //doesn't work
myTextLayers['word' + layerNum].value.fontSize = config.textSettings.fontSize; //doesn't work
myTextLayers['word' + layerNum].value.applyFill = config.textSettings.applyFill; //doesn't work
myTextLayers['word' + layerNum].value.fillColor = config.textSettings.fillColor; //doesn't work
myTextLayers['word' + layerNum].value.justification = config.textSettings.justification; //doesn't work
myTextLayers['word' + layerNum].value.tracking = config.textSettings.tracking; //doesn't workalert( myTextLayers['word' + layerNum].value); //just 'text' is here
myTextLayers['word' + layerNum].property.setValue(myTextLayers['word' + layerNum].value);
myTextLayers['word' + layerNum].layer.position.setValue([0,layerNum*100]); // works
}