-
AE Scripting: trying to edit text in a layer
Hi,
I’m new to scripting in AE. So far have managed to create a dialog and get input, copy layers from another composition, copy the sourceText from that layer and make layers visible. I have text from an edittext field. In another script it can be set as the sourceText.
I cannot seem to combine the imported layer text with the edittext field. Both are string values, so I am confused.
The script included starts after the dialog declaration. This is the last piece in a bigger script.
// assign values to the relevant compositions & setup global variables
var compList = app.project.item(1); // composition with the list of cameras
var compEditing = app.project.activeItem;
var focalLen = “”;
var zoomLen = “”;
function setLens(){
focalLen = ” @ ” + focalLength.text + “mm”;
if(lens1.value == true){
app.project.item(1).layer(11).copyToComp(compEditing); // layer 11 has the needed text
var zoom = compEditing.layer(1).text.sourceText.value; // get text from the imported layer
alert(zoom); // display the imported layer text
// zoomLen = zoom + focalLen; // combine imported layer text with the focalLen text – fails here
alert(zoom + focalLen); // display the focallen text – this also fails
// alert(zoomLen); // display the combined impoted and focalLen text
compEditing.layer(1).property(“Source Text”).setValue(zoomLen); // set the text for the layer to the combined value
}
compEditing.layer(1).enabled = true;
}
dialog.show();
dialog.center();
Any help would be appreciated.
Blessings
Rob