You can’t access to comp by name directly, you must do it by index or by writing a findComp function like this:
function findComp(compName){
var proj = app.project;
for(var i = 1; i <= proj.numItems; i++){
var comp = proj.item(i);
if(!(comp instanceof CompItem) || comp.name != compName){
continue;
}
else {
return comp;
}
}
}
Other problem is that you only have one layer on your comp, so you can`t acces layer[2]. In layers case, you can acces layer by name. You can write this bellow findComp function:
var myComp = findComp("Text 01");
myComp.layer("Layer 1").text.sourceText.setValue( "Your value");