Skip navigation
Currently Being Moderated

Count paragraphs...

Jul 29, 2012 5:02 AM

With this:

var docParCount = app.documents.everyItem().stories.everyItem().paragraphs.length; // paragraphs

... count the paragraphs.

 

But in Indesign (F8) we can see the character count, word, paragraph... but only counts paragraphs with text, no line breaks without text. How I can get this with a script?

 

F8.jpg

 

Thanks.

 
Replies
  • Currently Being Moderated
    Jul 29, 2012 10:34 AM   in reply to Marcos Suárez

    Hi,

     

    any kind of GrepSearch?

     

    app.findGrepPreferences = null;  

    app.findGrepPreferences.findWhat = "^.+$";   //or ".+\r"

    var _myGrep = app.activeDocument.findGrep().length;  

     

    $.write(_myGrep)

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 12:45 AM   in reply to Marcos Suárez

    @Marcos – be aware, that with your line of code in your question you'll never get to footnotes or tables in stories or nested tables in tables or tables in footnotes…

     

    I really think the best way for scripting that would be a GREP search. If it's too slow, I fear you have to write a C++ plugin.

     

    Uwe

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points