Wednesday, September 29, 2010

How to Add Word Count Function in TextEdit, Mac OS

It's no fresh news. I did not want to install the dominating Office just for counting words. I believe there's always an alternative.
Here we go!


Go to Applications -> Utilities -> AppleScript Editor
Click Preferences of it.
Check to "Show Script menu in menu bar"




Paste the following:


tell application "TextEdit"
set word_count to count words of document 1
set char_count to count characters of document 1
set show_words to (word_count as string) & " words. (" & (char_count as string) & " characters.)"
set dialog_title to "TextEdit Word Count"
display dialog show_words with icon 1 with title dialog_title buttons {"Ok"} default button "Ok"
end tell

Save to /Library/Scripts




(I named as Count)

I guess you could see the script on the menu bar as shown.



Done!
Beautiful lovely Mac!