25 Replies Latest reply: Jun 22, 2013 9:51 AM by MadMac55 RSS

    Indesign CS6 Total Document Word Count... No?

    evanexempt Community Member

      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

        • 1. Re: Indesign CS6 Total Document Word Count... No?
          P Spier CommunityMVP

          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.

          • 2. Re: Indesign CS6 Total Document Word Count... No?
            peter at knowhowpro Community Member

            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

            • 3. Re: Indesign CS6 Total Document Word Count... No?
              rob day CommunityMVP

              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

              • 4. Re: Indesign CS6 Total Document Word Count... No?
                rob day CommunityMVP

                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

                • 5. Re: Indesign CS6 Total Document Word Count... No?
                  Laubender CommunityMVP

                  @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

                  • 6. Re: Indesign CS6 Total Document Word Count... No?
                    evanexempt Community Member

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

                    • 7. Re: Indesign CS6 Total Document Word Count... No?
                      evanexempt Community Member

                      Thank you, everyone, for the information on better understanding how text/words are treated/understood by Indesign's 'brain'. This is very interesting, though a little over my head just yet.  Great learning avenues though!

                       

                      I still think that Adobe ought to consider making 'collective word count' command options features available for dullard creative types like me.  My particular publication may have several designers working on our layouts for a given issue, so we are page proofing the articles as separate INDD documents before we compile them into a master 'Indesign Book' with the cover jacket to format for printing.   It's just nice for an editor with limited software skills to be able to open one of these files and be able to tell at a glance what the word count is, even if the article uses multiple text boxes in its layout.  I don't think that is asking too much. #MyTwo

                       

                       

                      Cheers, and thanks again, everyone, for the information!

                      • 8. Re: Indesign CS6 Total Document Word Count... No?
                        rob day CommunityMVP

                        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

                        • 9. Re: Indesign CS6 Total Document Word Count... No?
                          peter at knowhowpro Community Member

                          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

                          • 10. Re: Indesign CS6 Total Document Word Count... No?
                            Joel Cherney CommunityMVP

                            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.

                            • 11. Re: Indesign CS6 Total Document Word Count... No?
                              peter at knowhowpro Community Member

                              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

                              • 12. Re: Indesign CS6 Total Document Word Count... No?
                                rob day CommunityMVP

                                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.

                                • 13. Re: Indesign CS6 Total Document Word Count... No?
                                  Tom Usrey Community Member

                                  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.

                                  • 14. Re: Indesign CS6 Total Document Word Count... No?
                                    [Ariel] Community Member

                                    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.length;}

                                    catch(e){}

                                    try {myWords +=

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

                                    catch(e){}

                                    alert (myWords);

                                     

                                    HTH,

                                    Ariel

                                    • 15. Re: Indesign CS6 Total Document Word Count... No?
                                      [Ariel] Community Member

                                      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

                                      • 16. Re: Indesign CS6 Total Document Word Count... No?
                                        evanexempt Community Member

                                        I feel curiously rewarded for having provoked this excited exchange of geekery.  *Imagining myself as a child asking a question that sends my parents off on some intellectual tangent, and thinking, "Wow. Look what I did."

                                         

                                        And I will file a features request with Adobe re: enhancing the word count automation in ID.  Thank you.

                                        • 17. Re: Indesign CS6 Total Document Word Count... No?
                                          Laubender CommunityMVP

                                          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

                                          • 18. Re: Indesign CS6 Total Document Word Count... No?
                                            peter at knowhowpro Community Member

                                            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.

                                            • 19. Re: Indesign CS6 Total Document Word Count... No?
                                              Eugene Tyson CommunityMVP

                                              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

                                              • 20. Re: Indesign CS6 Total Document Word Count... No?
                                                Joel Cherney CommunityMVP

                                                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.

                                                • 21. Re: Indesign CS6 Total Document Word Count... No?
                                                  Laubender CommunityMVP

                                                  @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

                                                  • 22. Re: Indesign CS6 Total Document Word Count... No?
                                                    Joel Cherney CommunityMVP

                                                    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.

                                                    • 23. Re: Indesign CS6 Total Document Word Count... No?
                                                      Eugene Tyson CommunityMVP

                                                      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.

                                                      • 24. Re: Indesign CS6 Total Document Word Count... No?
                                                        Eugene Tyson CommunityMVP

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

                                                        • 25. Re: Indesign CS6 Total Document Word Count... No?
                                                          MadMac55 Community Member

                                                          Wicked smart, Eugene !