Skip to main content
Marcos_Suárez
Known Participant
July 29, 2012
Question

Count paragraphs...

  • July 29, 2012
  • 2 replies
  • 1815 views

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?

Thanks.

This topic has been closed for replies.

2 replies

Community Expert
July 30, 2012

@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

Inspiring
July 29, 2012

Hi,

any kind of GrepSearch?

app.findGrepPreferences = null;  

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

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

 

$.write(_myGrep)

Marcos_Suárez
Known Participant
July 29, 2012

Thanks, but "search" (grep/text) is very slow with large documents...