Feature Request: Scriptwriting Word Count to exclude non-dialogue words

Apologies if this feature request is already mentioned; I searched but could not find it. I use Scriv almost exclusively for plays. I would love a feature, where in Scriptwriting mode, I can set word count to display ONLY dialogue. That is for Scriv to use Scriptwriting prompts (Scene Action, Character, Dialogue) to filter ONLY for dialogue. I then, convert dialogue word count to ‘words spoken per minute’ to give me a scene length (time on stage). As per my silly sample below, I can have 1000 words written but if there’s only two of dialogue, then I need to keep writing. If there is a way for me to do this, please let me know, and if not, I mean, I’m not a coder, but how hard could it be, right? :mrgreen:

[quote=“AstonishingGoddess”]
I’m not a coder, but how hard could it be, right? /quote]

I believe that’s on page one of the book “1001 phrases guaranteed to get software developers to hate you.”

On a more serious note, have you tried making a Collection that only shows dialogue, and then count those words?

Thanks PopcornFlix for your suggestion. I took a look at Collections, (not having used them before) and couldn’t work out how I might do that, but appreciate the thought.

There’s also this idea which is closely related:

word count by dialogue character

Getting what you want looks like it is just one step removed from this idea (requiring a simple summing at the end).

Thanks for this. Did you share the (apple) script somewhere? I’m keen to try it.

Been awhile since I used that, so let me test to make sure it still works. Also, I will add to it the summing function you need. Will get back here soon with that. And, yeah, it is applescript, so (for your safety) you can easily examine the code.

Turns out I wrote two such applescripts. There is one which you use by just copying the script text to the clipboard and invoking the script. The other works by first compiling the script to MS Word and opening it in Word, then invoking that script.

The first script will work on fewer script formats. The latter script identifies character/dialogue lines by the paragraph styles Scrivener uses when generating the document, rather than identifying them by the format of the line.

I have added a GRAND TOTAL line to the output of each script for you.

For your safety, these script files (.scpt) can each be opened in Script Editor and examined, so you may assure yourself that they are not accessing unexpected resources or doing anything other than what they should be. --gr

Applescripts included here:

Script Clip Count Per Character.scpt

USE: Copy script text right from Scrivener, then invoke this script.

SKETCH: Script skims the text on the clipboard until it sees a line which starts with “SCENE”. It then starts looking for paragraphs that have a ‘:’ in them, on the assumption such lines are dialogue lines with format characterName : dialogue. Script excludes parentheticals from the word count as you would expect.

Word Count Script Doc Per Character

USE: Compile script to Word. Open result in Word. Invoke this script.

SKETCH: This script works by looking for three kinds of style marks in the paragraph: ‘Character’, ‘Dialogue’ and ‘(Cont.)’. If your script format has character and dialogue on the same line, the script assumes a ‘:’ separates the character name from the dialogue text. Because this script drives Word, it runs notably slower than the other script.

KNOWN ISSUE: For reasons unknown, this script sometimes will register a line of dialogue as if spoken by a separate character. So, for example, the character ALICE will get a large word count, but then there will also be another “ALICE” listed in the totals who gets a small word count from a single line of dialogue somewhere. Why these don’t register as the same character is a mystery. I deemed the script still useful enough in spite of this bug.

NOTE: In order to use this script, you will need once to first open it in Script Editor and change this line <tell application “Word”>, so that it uses your computer’s name for your installation of MS Word. In all likelihood that app is called “Microsoft Word” on your mac.

script per-character word counts.zip (45.0 KB)

Thank you, that’s nice of you to share. I’ll give it a go and let you know how it goes.

Unfortunately I can’t get the script to work. I’m sure this is a user problem. I haven’t invoked scripts before but I did follow your instructions. It just kept saying “Microsoft Word got an error: AppleEvent timed out”. I’ll have another go tomorrow. Thanks again for the scripts (I tried both).

It may be that MS has changed their Applescript function set up for Word between the version of Word I targeted when writing the script and your current version of Word. It still works with my version of Word, but then I don’t upgrade Word unless I have to. What version of Word do you have?


If you want to see where the script is failing, open your compiled screen play doc in Word and then open the script in Script Editor, enable the Events display (View>Show Log, then click Events tab), and run the script right from Script Editor. This will give you a readout of what happens so you can see how far the script gets. If you wanted, you could select all of that readout and copy and paste to me to look at.


To boil it down (and for anyone who is an Applescripter who is reading this and might have insight), the script just assumes that (the frontmost document open in Word is the screenplay document and) that Word understands the following two sorts of Applescript commands:

  1. get the name local of the style of paragraph n of the text object of the active document.
  2. get the content of the text object of paragraph n of the text object of the active document.

where the highlighted terms are terms specified in the Applescript dictionary that word supplies for script-controlling the app. And that is it – those are the only function calls to the Word app the script uses.