I hope this is something you were looking for.
(function() {
// Get active composition
var composition = app.project.activeItem;
if (!composition || !isComposition(composition))
return alert("Please select composition first");
// Get selected layer and make sure it's a Text Layer
var layer = composition.selectedLayers[0];
if (!layer || !isTextLayer(layer)) {
return alert("Please select a text layer.");
}
// Get font family
var fontFamily = getFontFamily(layer);
var layersThatMatchFontFamily = [];
// Loop through all the comps and collect all text layers
// witch matches fontFamily;
var allCompositions = getAllCompositions();
for (var i = 0, il = allCompositions.length; i < il; i++) {
composition = allCompositions;
for (var j = 1, jl = composition.numLayers; j <= jl; j++) {
layer = composition.layer(j);
if (isTextLayer(layer) && getFontFamily(layer) === fontFamily) {
layersThatMatchFontFamily.push(layer);
}
}
}
// Done.
var message = "Font \"" + fontFamily + "\" has been used " + layersThatMatchFontFamily.length + " times.\n";
message += buildLocation(layersThatMatchFontFamily).join("\n");
alert(message);
function isTextLayer(layer) {
return layer instanceof TextLayer;
}
function isComposition(item) {
return item instanceof CompItem;
}
function getFontFamily(textLayer) {
var textDocument, textValue, fontFamily;
textDocument = textLayer.property("ADBE Text Properties").property("ADBE Text Document");
textValue = textDocument.value;
fontFamily = textValue.fontFamily;
return fontFamily;
}
function getAllCompositions() {
var composition, compositions;
compositions = [];
for (var i = 1, il = app.project.numItems; i <= il; i++) {
composition = app.project.item(i);
if (isComposition(composition)) {
compositions.push(composition);
}
}
return compositions;
}
function buildLocation(layers) {
var layer, locations;
locations = [];
for (var i = 0, il = layers.length; i < il; i++) {
layer = layers;
locations.push(layer.containingComp.name + " > " + layer.name);
}
return locations;
}
})();