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

Slowly Rebooting in 286 Mode

The lumbar radiculopathy, which sounds too much like "ridiculously" for me, hasn't faded completely. My left leg still cramps, tingles, and hurts with sharp pains. My mind remains cloudy, too, even as I stop taking painkillers for the back pain and a recent surgery.

Efforts to reboot and get back on track intellectually, physically, and emotionally are off to a slow, grinding start. It reminds me of an old 80286 PC, the infamously confused Intel CPU that wasn't sure what it was meant to be. And this was before the "SX" fiascos, which wedded 32-bit CPU cores with 16-bit connections. The 80286 was supposed to be able to multitask, but design flaws resulted in a first-generation that was useless to operating system vendors.

My back, my knees, my ankles are each making noises like those old computers.

If I haven't already lost you as a reader, the basic problem is that my mind cannot focus on one task for long without exhaustion and multitasking seems…

MarsEdit and Blogging

MarsEdit (Photo credit: Wikipedia) Mailing posts to blogs, a practice I adopted in 2005, allows a blogger like me to store copies of draft posts within email. If Blogger, WordPress, or the blogging platform of the moment crashes or for some other reason eats my posts, at least I have the original drafts of most entries. I find having such a nicely organized archive convenient — much easier than remembering to archive posts from Blogger or WordPress to my computer.

With this post, I am testing MarsEdit from Red Sweater Software based on recent reviews, including an overview on 9to5Mac.

Composing posts an email offers a fast way to prepare draft blogs, but the email does not always work well if you want to include basic formatting, images, and links to online resources. Submitting to Blogger via Apple Mail often produced complex HTML with unnecessary font and paragraph formatting styles. Problems with rich text led me to convert blog entries to plaintext in Apple Mail and then format th…

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…