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

Paragraph with 3 lines or less indented till after first word

Return to Member Forum

  • Author
    Posts
    • #1201882
      Year 1917
      Member

      Hi

      Does someone have a script that a paragraph with 3 lines or less, the lines should be indented till after the first word and the space of the first line.
      Thanks

    • #14323448
      Brian Pifer
      Participant

      This is a pretty niche thing, so don’t think a script exists for it. You could create a paragraph style that does what you want, then cycle through the paragraphs, see if they have 3 or fewer lines, and apply the paragraph style to those lines?

    • #14323445

      It *is* a niche thing, but it’s a small enough request to write a custom script for. This one requires you to click inside the story to process – it does not Play Nice with stuff like locked layers and master pages and such.
      It just inserts the Indent To Here marker at the start of the second word in a story. It also processes one-line paragraphs, which is kinda superfluous, but there you go, it was in the specs.

      //DESCRIPTION:Indent 3-line paragraphs after first word
      // A Jongware Script 15-Dec-2019
      // 1. Iterate over all paragraphs.
      allParagraphs = app.selection[0].parentStory.paragraphs;
      // 2. Filter out 3-lines-or-less.
      for (i=0; i<allParagraphs.length; i++)
      {
      // 3. Indent them after the first word.
      if (allParagraphs[i].words.length > 1 && allParagraphs[i].lines.length <= 3)
      {
      allParagraphs[i].words[1].insertionPoints[0].contents = '\u0007';
      }
      }
Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Forum Ads