if ( app.documents.length > 0 ) {
for ( i = 0; i< app.activeDocument.textFrames.length; i++) {
var allSizes = []; //set up empty array
textArtRange = app.activeDocument.textFrames[i].textRange;
var fontName = textFonts.getByName("Nobile");
alert (fontName);
textArtRange.characterAttributes.textFont = fontName;
var fontSizes = textArtRange.characterAttributes.size;
allSizes.push(fontSizes)
alert (fontSizes);
}
alert (allSizes);
}
全尺寸的警报仅返回单个值,而不是数组。
您在for循环的内部设置空阵列。它每次都在重置它。将其移到for循环上方:
allSizes = []