Skip to main content
evanexempt
Participant
June 16, 2013
Question

Indesign CS6 Total Document Word Count... No?

  • June 16, 2013
  • 4 replies
  • 16168 views

I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:

What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?

I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??

Pardon my exasperation in the above comment, but....Seriously?  

I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.

Thank you.

- Exasperated Journalist Slag

This topic has been closed for replies.

4 replies

Joel Cherney
Community Expert
Community Expert
June 19, 2013

Thanks for giving me such a good reason to slap myself on the forehead, Eugene. I don't think I'll even need coffee this morning. That must be the simplest solution imaginable. There's no way to address Peter Gold's "advanced" wordcount concepts - no way to exclude the pasteboard, for example - but that's not really at issue here. And I wonder if InDesign's ability to count words in stories obeys the same word-boundary-identification rules that the GREP engine uses.

Community Expert
June 19, 2013

@Eugene – that is really clever… !!

@Joel – there is a way for excluding the pasteboard.

See the following script by Marc Autret:

http://www.indiscripts.com/post/2009/09/clean-up-your-pasteboard

Uwe

Joel Cherney
Community Expert
Community Expert
June 19, 2013

Well, if you're going to use a script to exclude the pasteboard, you may as well use a script to count the words too, right?  That's part of the beauty of Eugene's suggestion - it addresses the OP's initial question, and does not require using the scripting interface.

Which brings the thread neatly back to evanexempt's original exasperation: the thing that to my mind makes InDesign the "most advanced page layout application on Earth" is its extensibility via the scripting interface. But if you don't know any scripting languages, or how to install or modify the scripts that the incredibly helpful InDesign community likes to give away, then there is no obvious way to count all the words in a document with a minimum of effort. Unless you're Eugene, it seems.

rob day
Community Expert
Community Expert
June 16, 2013

If you are using OSX this AppleScript displays the total word count:

tell application "Adobe InDesign CS6"

    tell active document

        set s to every story

        set t to 0

        repeat with i from 1 to count of s

            set t to t + (count every word of item i of s)

        end repeat

        display dialog "This document has " & (count of s) & " stories, with a total of " & t & " words"

    end tell

end tell

Inspiring
June 11, 2018

This works great except for if there is a table. Any Idea why it doesn't count words in tables? I ran this on one file and got a word count of 25. I converted the PDF to word to get a better count and came up with 17,112 words.

rob day
Community Expert
Community Expert
June 11, 2018

Ariel's JavaScript in #14 should get tables:

myWords = app.activeDocument.stories.everyItem().words.length;

try {myWords +=

    app.activeDocument.stories.everyItem().footnotes.everyItem().words.length;}

catch(e){}

try {myWords +=

    app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().words.length;}

catch(e){}

alert (myWords);

Participating Frequently
June 16, 2013

Yes, there are ways, just not what you expected.

One approach to counting words in multiple text frames in InDesign is to thread them together. To maintain the pieces of text in their assigned threaded text frames, you can create a paragraph style that starts in the next frame, and assign it to the first paragraph in each text frame. Or, you can break the threads when the count is stable.

If the text frames need to adjust their size to the amount of their content, search Google for terms like "indesign auto resize text frame" without quotes for details.

There was a recent discussion about auto-resizing text frames that mentioned the free AutoFit InDesign plug-in, from typefi.com. Search Google for terms like "indesign typefi autofit" for details.

Search Google for terms like "threading and unthreading InDesign text frames" without quotes, for details.

Search Google for terms like "indesign start paragraph in next frame" without quotes, for details.

You can file a formal feature improvement request here: Wishform.

HTH

Regards,

Peter

_______________________

Peter Gold

KnowHow ProServices

evanexempt wrote:

I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:

What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?

I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??

Pardon my exasperation in the above comment, but....Seriously?  

I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.

Thank you.

- Exasperated Journalist Slag

Peter Spier
Community Expert
Community Expert
June 16, 2013

Yeah, out of the box that would be true. But I'm sure it's possible to script a total count. Be careful what you are asking, though. Total count would include headers and footers and page folios unless you can design a way to ignore them.

rob day
Community Expert
Community Expert
June 16, 2013

Total count would include headers and footers and page folios unless you can design a way to ignore them

If the folios/headers are master page items my script wouldn't include them. You could also skip stories with less than a designated number of words like this, which skips stories with less than 10 words:

tell application "Adobe InDesign CS6"

    tell active document

        set s to every story

        set t to 0

        repeat with i from 1 to count of s

            if (count every word of item i of s) is greater than 10 then

                set t to t + (count every word of item i of s)

            end if

        end repeat

        display dialog "This document has " & (count of s) & " stories, with a total of " & t & " words"

    end tell

end tell

evanexempt
Participant
June 18, 2013

Thank you, but I am on Windows 7 (which makes me less cool, I know.)