Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Start position of paragraph text

Return to Member Forum

  • Author
    Posts
    • #1202642

      I need to get the starting position of text, for every paragraph of text on my page.
      Is there a way to find this in scripting?

    • #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

      }

    • #14323443

      Thanks, Brian !

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Forum Ads