How to tabulate a word count in TextEdit

Fri, Dec 11, 2009

News

TextEdit is a great text editor that comes standard with OS X.  While it obviously doesn’t have all the bells and whistles of, say Microsoft Word, it’s a quick and seamless way to be productive without any of the headaches or complexity that sometimes accompany large word processors. You see, for certain tasks, sometimes less is more.

But there are times where some basic word processing features would come in quite handy, with one glaring example being the ability to tabulate a word count in a TextEdit document.  Fortunately, there’s a way to figure that out without copying and pasting text into a different application.

In order to calculate a TexEdit document’s word count, first open up the AppleScript Editor which, under Snow Leopard, resides in the Utilities folder which can be found in the Applications folder.  Once the app is open, type the following command into the command line:

tell application “TextEdit”
count words of document 1
end tell

Next, press the ‘Run’ icon up top and you’ll see the word count of the foremost TextEdit document appear in the window below.  Below, check out a quick video demonstration that should clear up any questions you may have.

  Share

, ,

1 Comments For This Post

  1. Sal Says:

    By the way, if you’re using Snow Leopard, create a service that counts the selected text in TExtEdit.

    Open AUtomator, choose new Service from the template sheet.

    Leave the input settings set for text in any application.

    Add the RUn AppleScript action and replace the default with this:

    on run {input, parameters}

    set the word_count to the count of words of (input as string)
    say the word_count as string

    return input
    end run

    Save as Word Count of Selection

    In TExtEdit, select some text, and control-click in the selection to bring up the contextual menu. At the bottom of the menu will be your service. Select it and your computer will speak the word count!

eXTReMe Tracker