Skip navigation
Currently Being Moderated

Indesign CS6 Total Document Word Count... No?

Jun 15, 2013 11:37 PM

Tags: #indesign #document #multiple #cs6 #total #text_boxes #word_counts #word_count #wordcount #wordcounts #textboxes

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

 
Replies
  • Currently Being Moderated
    Jun 16, 2013 5:44 AM   in reply to evanexempt

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2013 6:37 AM   in reply to evanexempt

    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

     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    Jun 16, 2013 7:25 AM   in reply to evanexempt

    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

     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    Jun 16, 2013 7:39 AM   in reply to Peter Spier

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2013 7:42 AM   in reply to Peter Spier

    @Peter – counting words isn't an *exact* science.
    Some people would be surprised what exactly a "word" is in InDesign:

     

    Marc Autret: What Exactly is a Word?

     

    http://www.indiscripts.com/post/2011/09/what-exactly-is-a-word

     

    Uwe

     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    Jun 18, 2013 12:54 PM   in reply to evanexempt

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

     

    It's a simple script, so you might try posting it in scrpting forum and see if someone will translate it to .jsx

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2013 1:02 PM   in reply to evanexempt

    File a formal feature enhancement request as suggested in post #2 above. Without your taking this step, Adobe won't know your needs. Folks on this forum are not "Adobe people," we're users like you.

     

     

    HTH

     

     

    Regards,

     

     

    Peter

    _______________________

    Peter Gold

    KnowHow ProServices

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2013 1:19 PM   in reply to evanexempt

    I have a CS4-era script stashed away somewhere that counts all words in all stories and spits up a single dialog with the total document word count, but I can't find it anywhere (we only do word counts in applications that our clients use to do word counts, in order to avoid conflicts such as "what is a word in InDesign" versus "what is a word in MS Word.")

     

    DTP Tools makes a plugin that handles this task.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2013 1:51 PM   in reply to Joel Cherney

    Joel, thanks for the reminder. I often suggest those DTP plug-ins that solved problems for me. I never needed a thorough word count, so I didn't even think of this plug-in.

    Joel Cherney wrote:

    ...

    DTP Tools makes a plugin that handles this task.

     

     

    Regards,

     

     

    Peter

    _______________________

    Peter Gold

    KnowHow ProServices

     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    Jun 18, 2013 2:05 PM   in reply to Laubender

    Some people would be surprised what exactly a "word" is in InDesign:

    Just noticed that my script does not count one space in a text frame as a word the way Info does—so maybe the single space as a word is an Info bug.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2013 2:22 PM   in reply to Joel Cherney

    Joel --

     

    Is this the "word count" script?

     

    myDoc = app.activeDocument

    h = 0

    for ( var j = 0; myDoc.stories.length > j; j++) {

    h = myDoc.stories[j].words.length + h

    }

    alert("You have " + h + " words in this document" )

     

     

    Is this the "character count" script?

     

    myDoc = app.activeDocument

    h = 0

    for ( var j = 0; myDoc.stories.length > j; j++) {

    h = myDoc.stories[j].characters.length + h

    }

    alert("You have " + h + " characters in this document" )

     

     

    I know these are old; they have 2007 on them. Sorry, I don't have any other information about author.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2013 2:33 PM   in reply to Tom Usrey

    Look, a simple script for a word count is a one-liner:

     

    alert(app.activeDocument.stories.everyItem().words.length);

     

    This uses ExtendScript's built-in definition of what a word is. What

    precisely (in every grey-area case) that is I'm not sure, but it's

    fairly intuitive, in my experience.

     

    The above script does not include words in tables of footnotes. That

    would be a 4-liner:

     

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

    try {myWords +=

    app.activeDocument.stories.everyItem().footnotes.everyItem().words.len gth;}

    catch(e){}

    try {myWords +=

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

    catch(e){}

    alert (myWords);

     

    HTH,

    Ariel

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2013 2:36 PM   in reply to Tom Usrey

    Typo: "tables OR footnotes".

     

    Also, not sure what would happen here with nested tables, text frames in

    groups, words in anchored objects, etc. That would need a bit of testing.

     

    But a bread-and-butter doc word count it is.

     

    Ariel

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2013 8:42 PM   in reply to evanexempt

    And there are other *advanced* questions we have to ask:

     

    Do we want to count words in text frames on the pasteboard?
    How about layers with annotations, translations etc.?

    How to count tables nested in tables?*
    Text variables? Every instance?

     

     

    *Ariel already asked that.
    @Ariel: text frames in group objects are no problems:

     

    app.activeDocument.stories.everyItem() 
    

     

    will catch them. Also text frames in every state of MultiStateObjects (MSOs). Even if they are nested.

     

    Have fun!

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 19, 2013 8:29 AM   in reply to Laubender

    Laubender wrote:

     

    And there are other *advanced* questions we have to ask:

     

    Do we want to count words in text frames on the pasteboard?
    How about layers with annotations, translations etc.?

    How to count tables nested in tables?*
    Text variables? Every instance?

    What about reporting these subcategories as subtotals, and the grand total as well? For example:

     

         Visible layers

              Layer 1

                           Words in text frames:             

                                  Words in condition 1 visible          nnn

                                  Words in condition 2 hidden         nnn

     

                           Words in text variables            

                                  Words in condition 1 visible          nnn

                                  Words in condition 2 hidden         nnn

     

                           Words in container tables       

                                  Words in condition 1 visible          nnn

                                  Words in condition 2 hidden         nnn

     

                           Words in nested tables               nn

     

    and so on.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 19, 2013 8:38 AM   in reply to peter at knowhowpro

    How about Grep Find

     

    Find

    \w+

     

    Change to

    $0

     

     

    Results in a dialog box giving a word count.

     

     

    If you want it just for Body text, then choose that style in the Find Format

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 19, 2013 9:05 AM   in reply to evanexempt

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 19, 2013 9:16 AM   in reply to Joel Cherney

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 19, 2013 9:50 AM   in reply to Laubender

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2013 2:07 AM   in reply to Joel Cherney

    My solution doesn't come without certain caveats!

     

    I use a different style for Table Text called "Table Body" "Table Heading" "Table Bullet"

     

    These are children of the "Body" and "Heading" and "Bullet" and "Quotes" and "Pull Quotes" and a plethora of other styles.

     

    And "Heading" and "Bullet" are Children of the "Body" etc.

     

     

    So my Find would find just "Body" not it's children, so only paragraphs of text not within a table would be found.

     

     

    However, it's a simplistic way to get a Word Count. And if you're not bothered about Headings, Tables or Bullets you can do a full search - or search for a specific style.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2013 2:08 AM   in reply to Eugene Tyson

    I mixed up the Styles above in their relation to each other - but I think you know what I mean

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2013 9:51 AM   in reply to Eugene Tyson

    Wicked smart, Eugene !

     
    |
    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