Reply To: Start position of paragraph text

#14323460
Brian Pifer
Participant

This will hit the insertion point at the start of every paragraph on the first page of a document.

var pagePars = app.document[0].pages[0].textFrames.everyItem().paragraphs.everyItem().getElements();
for (var i = 0; i < pagePars.length;i++) {
var ip = pagePars[i].insertionPoints[0];
//do something at each insertionPoint
}

There are other ways to get to whichever paragraphs you need. For instance, if you had a textFrame selected with the black arrow tool, you could get the textFrame’s parent story paragraphs with this:

var psPars = app.selection[0].parent.paragraphs;
for (var i = 0; i < psPars.length; i++) {
var ip = psPars[i].insertionPoints[0];
//do something at each insertionPoint

}

This article was last modified on December 12, 2019

Comments (0)

Loading comments...