Using Indesign CS5.5, I have a vast collection of groups - all with an image and a textframe. The textframe has 3 paragraphs by default.
I need to get the text from the first paragraph of each textframe.
So far I have this:
var textboxes = app.activeDocument.groups.everyItem().textFrames;
for (i = 0; i <= textboxes.length; i++) {
if(textboxes[i] != 'undefined') {
var product = textboxes[i].contents;
$.writeln(product);
}
}
This gives me ALL the text...I really need to get the first paragraph only OR filter it somehow by font size.
I've tried using textboxes[i].paragraphs[0]
, but this returns the rather vague Object Invalid
. It might be a specific group, but it's too vague for me to tell.
Is there a way to skip and continue if an object is invalid. AND is there perhaps a way to only look for text with a certain font size?
Any help would be greatly appreciated. I find Indesign's scripting API documentation quite poor.