I haven’t tested this stuff, so there may be errors, but basically it’s like this. Finding a specific comp in the project window is kind of clunky, but you can do it like this:
var compName = “xxxx”; //comp name goes here
var myProject = app.project;
var n = myProject.numItems;
var foundIt = false;
var i;
for (i=1; i<=n; i++){
if (myProject.item(i).name == compName){
var myComp = myProject.item(i);
break;
}
}
Finding a layer in a comp is pretty much the way you do it in expressions:
var layerName = "yyyy"; //layer name goes here
var myLayer = myComp.layer(layerName);
Getting the length of a layer's source text would look like this:
var mySourceText = myLayer.text.sourceText;
var mySourceTextLen = mySourceText.len;
Hope that's helpful.
Dan