Skip to main content

Scripting Better Writing

Most writers develop patterns in their prose. Experts can use these patterns to calculate the likelihood that a given text was written by a particular author. For example, my weaknesses include "unfortunately" and "just." President Obama overuses the phrase, "Let me be clear." Does the president need our permission to be clear? I doubt anyone tries to obstruct presidential clarity.

Since buying my first copy of WordPerfect for DOS, I've maintained macros to help locate and remove my personal textual demons. The idea is simple: automatically highlight the words and phrases I might want to revise before submitting the text to an editor. Four years ago, a student noticed the red words in an open Word document on my laptop. She asked if the highlighting was part of Word's grammar or spellcheck features. I explained to her that when I finish writing a document I run several macros to mark potential problems.

When the student asked for a copy of the macro, I was confronted with what I call the "spellcheck" question: Does automatic "editing" help students?

There is a pedagogical concern when automating tasks associated with editing and revising. Teachers ask me if the automation leads to "laziness" among writers. I do not believe so. Using automation to highlight my weaknesses has helped me avoid the words and phrases during the writing process. In many ways, the word processor is acting as a coach. The macro I use does not change my words, nor does it suggest changes. Instead, I must decide if the highlighted words should be changed or removed. Sometimes, I leave the original words.

My students have found that customizing the macro for their individual writing patterns helps them discover patterns they didn't suspect existed. There are ways to generate "word frequency" tables, showing students which words they use most in a text. The frequency charts reveal "lots" of "really" abused words. Students are fascinated by this. The idea that a writer has a unique "voice" magically registers with students at that moment.

I am not opposed to automating editing tasks. No statistics instructor I know would oppose using Microsoft Excel macros. Creating the macros requires understanding the underlying concepts. A student has to understand what an adverb is and does before appreciating why some adverbs are "weak" word choices.

Below you will find the AppleScript I use when writing. When Microsoft shipped Office 2008 for the Mac, I had to convert my simple Visual Basic for Applications (VBA) macro to AppleScript. This conversion was also an opportunity to add functionality to the macro. I've been asked to cut word counts, reduce complexity, and target a broader audience. I added Word functions that help me meet the requirements of my editors.
Note: The AppleScript Editor has moved several times in OS X. In 10.6, the editor is located in the "Utilities" folder. You can use Spotlight to find the AppleScript Editor, if all else fails.
If you use MS Word for the Mac, the script I crafted can be copied and saved to the following folder:
~/Documents/Microsoft User Data/Word Script Menu Items/
-- Mark likely problems within a document
-- C. S. Wyatt 2010
-- List of Words to Mark as Potential Problems 
set markWords to {"about", "all", "almost", "a lot", "already", "always", "along with", "anxiously", ¬
"absolutely", "as well", "believe", "certainly", "clearly", ¬
"eagerly", "easy", "easily", "every", "feel", "felt", "few", "finally", "frequently", ¬
"good", "got", "intrigued", "intrigues", "just", ¬
"many", "merely", "must", "nearly", "need", "never", "nice", "not", "numerous", ¬
"only", "quick", "quickly", "so", "think", ¬
"utilize", "utilized", "utilizes", "very", ¬
"in the event", "in order to", "on the grounds that", "in case", "the public", ¬
"come to the conclusion"}
tell application "Microsoft Word"
-- Cycle through the markWords and Bold/Underline the words
repeat with theWord in markWords
set findRange to find object of text object of active document
tell findRange
set match whole word to true
set content of replacement of findRange to "{" & theWord & "}"
set bold of font object of replacement of findRange to true
set color index of font object of replacement of findRange to red
set underline of font object of replacement of findRange to underline thick
execute find find text theWord replace replace all
end tell
end repeat

-- Calculate stats
set statWordCount to compute statistics active document statistic statistic words
set statFKGradeLevel to get readability value of readability statistic 10 of text object of active document
set statParagraphs to get readability value of readability statistic 3 of text object of active document
set statSentences to get readability value of readability statistic 4 of text object of active document
set statSentPerParagraph to get readability value of readability statistic 5 of text object of active document
set statWordsPerSent to get readability value of readability statistic 6 of text object of active document
set statPassiveSents to get readability value of readability statistic 8 of text object of active document

-- Move to end of document
set currentDoc to text object of active document
insert break at currentDoc break type section break next page

-- Create a report on the document, after a page break
set currentDoc to collapse range currentDoc direction collapse end
insert paragraph at end of currentDoc
type text selection text "Report on Text"
type paragraph selection
type text selection text "Grade Level: " & statFKGradeLevel
type paragraph selection
type text selection text "Number of Paragraphs: " & statParagraphs & ¬
"; Sentences per Paragraph: " & statSentPerParagraph
type paragraph selection
type text selection text "Number of Sentences: " & statSentences & ¬
"; Words per Sentences: " & statWordsPerSent
type paragraph selection
type text selection text "Passive Sentences: " & statPassiveSents
type paragraph selection
type text selection text "Number of Words: " & statWordCount

end tell


Popular posts from this blog

Comic Sans Is (Generally) Lousy: Letters and Reading Challenges

Specimen of the typeface Comic Sans. (Photo credit: Wikipedia) Personally, I support everyone being able to type and read in whatever typefaces individuals prefer. If you like Comic Sans, then change the font while you type or read online content. If you like Helvetica, use that.

The digital world is not print. You can change typefaces. You can change their sizes. You can change colors. There is no reason to argue over what you use to type or to read as long as I can use typefaces that I like.

Now, as a design researcher? I'll tell you that type matters a lot to both the biological act of reading and the psychological act of constructing meaning. Statistically, there are "better" and "worse" type for conveying messages. There are also typefaces that are more legible and more readable. Sometimes, legibility does not help readability, either, as a type with overly distinct letters (legibility) can hinder word shapes and decoding (readability).

One of the co…

Let’s Make a Movie: Digital Filmmaking on a Budget

Film camera collection. (Photo credit: Wikipedia) Visalia Direct: Virtual Valley
June 5, 2015 Deadline
July 2015 Issue

Every weekend a small group of filmmakers I know make at least one three-minute movie and share the short film on their YouTube channel, 3X7 Films.

Inspired by the 48-Hour Film Project (, my colleagues started to joke about entering a 48-hour contest each month. Someone suggested that it might be possible to make a three-minute movie every week. Soon, 3X7 Films was launched as a Facebook group and members started to assemble teams to make movies.

The 48-Hour Film Project, also known as 48HFP, launched in 2001 by Mark Ruppert. He convinced some colleagues in Washington, D.C., that they could make a movie in 48 hours. The idea became a friendly competition. Fifteen years later, 48HFP is an international phenomenon, with competitions in cities around the world. Regional winners compete in national and international festivals.

On a Friday night, teams gathe…

Edutainment: Move Beyond Entertaining, to Learning

A drawing made in Tux Paint using various brushes and the Paint tool. (Photo credit: Wikipedia) Visalia Direct: Virtual Valley
November 2, 2015 Deadline
December 2015 Issue

Randomly clicking on letters, the young boy I was watching play an educational game “won” each level. He paid no attention to the letters themselves. His focus was on the dancing aliens at the end of each alphabet invasion.

Situations like this occur in classrooms and homes every day. Technology appeals to parents, politicians and some educators as a path towards more effective teaching. We often bring technology into our schools and homes, imagining the latest gadgets and software will magically transfer skills and information to our children.

This school year, I left teaching business communications to return to my doctoral specialty in education, technology and language development. As a board member of an autism-related charity, I speak to groups on how technology both helps and hinders special education. Busin…