Hi.
I’ve found a way. I’m pasting it below just in case someone want to use it or maybe improve it.
Thanks,
Luiz
—-
myDoc = app.activeDocument
var myDoc = app.activeDocument;
// create arrays to save frame infos
var xizes = [];
var xizes2 = []
var ipes = [];
var ipes2 = [];
var valors = [];
var valorsw = [];
// get frame infos (position and text lenght)
tf = app.activeWindow.activePage.textFrames;
var fim = tf.length;
for(var i = 0; i<fim; i++){
textFrame = tf[i];
tamanho = textFrame.characters.length;
palavras = textFrame.words.length;
par = textFrame.paragraphs.length;
// the locations for the textframe
var sp = 5;
var y1 = textFrame.geometricBounds[0] – sp;
var x1 = textFrame.geometricBounds[1];
var y2 = textFrame.geometricBounds[2] – sp;
var x2 = textFrame.geometricBounds[3] – sp;
xizes[xizes.length] = x1;
ipes[ipes.length] = y1;
xizes2[xizes2.length] = x2;
ipes2[ipes2.length] = y2;
valors[valors.length] = tamanho;
valorsw[valorsw.length] = palavras;
}
// create one frame for each existing, in a position a little different, showing char count
var main = function() {
var doc = app.activeDocument;
// set the origin to the page
var curr_origin = doc.viewPreferences.rulerOrigin;
doc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
tf = app.activeWindow.activePage.textFrames;
var ende = tf.length;
for(var g = 0; g < ende ; g++){
var content = “Chars: ” + valors[g] + ” Words: ” + valorsw[g];
// create the textframe
var tf = app.activeWindow.activePage.textFrames.add({
contents: content,
geometricBounds: [ipes[g], xizes[g], ipes2[g], xizes2[g]]
});
// apply style: I’ve made one with a PINK shading to simulate a box
tf.paragraphs[0].appliedParagraphStyle = doc.paragraphStyles.item(“myStyle”);
}
doc.viewPreferences.rulerOrigin = curr_origin;
};
main();