Use this script on a Text Layer to show the active layer name.
txt = “”;
for (j = 1; j <= thisComp.numLayers; j++){ if (j == index) continue; L = thisComp.layer(j); if (! (L.hasVideo && L.active)) continue; if (time >= L.inPoint && time < L.outPoint){
try{
txt = L.source.name;
}catch(err1){
txt = L.name
}
break;
}
}
txt}