How to get the mixed up character properties (font size and font style) from the same text layer
Hi All,
I need a script to find out, if the text layer contain more than one font style or font size (different font style or font size used in the same layer) in After effects.
I have the script (placed below) for get the font style, font size details in the after effects, but it will give the details for the first character's properties alone.
Can you please advise to get each word properties or else to alert if the text layer contain more than one format (either font or font size).
query();
function query() {
var myTxtInfo_Ary = [];
var myProj = app.project;
var myComp = myProj.activeItem;
var myLayers = myComp.layers;
for (var i = 1; i <= myLayers.length; i++) {
var myLayer = myLayers[i];
if (myLayer instanceof TextLayer) { // Check if the layer is a text layer
if (myLayer.enabled == true) { // Check if the layer is enabled
var myTxtProp = myLayer.property("ADBE Text Properties").property("ADBE Text Document");
var myTxtDoc = myTxtProp.value; // Access the text document
var myCopy = myTxtDoc.text;
var myFontStyle = myTxtDoc.fontStyle;
var myFontSize = myTxtDoc.fontSize;
// pushing text properties
myTxtInfo_Ary.push({
text: myCopy,
fontStyle: myFontStyle,
fontSize: myFontSize
});
}
}
}
for (var i = 0; i < myTxtInfo_Ary.length; i++) {
$.writeln("Text: " + myTxtInfo_Ary[i].text);
$.writeln("Font Style: " + myTxtInfo_Ary[i].fontStyle);
$.writeln("Font Size: " + myTxtInfo_Ary[i].fontSize);
$.writeln("------");
}
}
Thanks
Asuvath
