i have a quick question for you that is currently slowing me down on a scripting project.
When i use the following code to alert the length of a source text string from the first layer within a comp, i just get an error:
Code: Select all
app.beginUndoGroup("get text length");
var comp = app.project.activeItem; //selected composition
txt = comp.layer(1).text.sourceText.value.text.length(); // get selected comp's first text layer's text length (amount of characters)
alert(txt);
app.endUndoGroup();
But i need to do various length checks to compare line lengths, amount of line breaks etc. .split() is not working either. What am I doing wrong? In expressions, this was never a problem. I must be missing just a tiny detail to make it work.