Add a Word and Character Count to Any Mac Program

Apple’s operating system is known for its ease of use and full-featured functionality. That doesn’t mean that it always does everything you’d like it to, though. Luckily, a lot of those missing features can be created with a little know-how. One feature that’s always handy to have is a character and word count function. Follow the steps below and you can have character and word counts at your beck and call with just a right click.

The command will be entered into Automater. Open up your Applications and find Automater to start.

Once  you have opened Automater, you will be prompted to select a template. Your workflow will be a Service, so select Service and click “Choose.”

mac-service

There are two columns on the left side of the window. In the second column are a list of selectable actions. Using the search or the scroll, find “Run AppleScript.” Double-click it and you will be presented with the AppleScript terminal.

Select the command below and paste it into the AppleScript terminal.

on run {input, parameters}
    try
	set MyText to input as string
	set NombreSignes to the number of characters of MyText
	set NombreMots to the number of words of MyText
	set NombrePara to the number of paragraphs of MyText
	set LeResultat to "The selected text contains :" & return & "- " & NombreSignes & " sign(s) ;" & return & "- " & NombreMots & " word(s) ;" & return & "- " & NombrePara & " paragraph(s)."
	display dialog LeResultat buttons {"OK"} default button 1 with icon note
    on error errmsg number errnum
	display dialog errmsg & " [" & errnum & "]" buttons {"OK"} default button 1 with icon stop
    end try
    return input
end run

Hit the green Play button to see the script in action.

mac-run-applescript

Once you’ve confirmed that the code is working, save the command with a name like “Count Selected Characters” or some variation of that. Make it something you will recognize and understand the function of when you see it.

Once the command is entered, open up a program of your choice. Select a group of text within that program and right click. At the bottom of your menu, you should now see a command with the name that you gave it.

mac-automator-script

Click on it and it will deliver a pop up screen that tallies the character and word count of your selected text.

Having easy access to a word count function is something that TextEdit users have been dying for. It’s also a great feature to have around for Mail.app users who try to keep their character count low during correspondence. With the addition of Twitter and social network integration into OS X, having a quick way to check character count is extremely handy. It’s much easier to keep your words concise and punchy when you have the ability to check it just a click away. This is a simple service that will serve you well, whether you’re a writer with a word quota or a constant Twitter user with a character cap. Keep it all in check with this easy to execute command.

Do you like what you read here?

Receive the latest update in your inbox.

Or connect with us: