How to count words in TextEdit

Word counter for TextEdit

TextEdit is the word processor that has always accompanied the different versions of OS X and that is still present. It is the successor to SimpleText and best of all, it is free. That is, once you get a Mac computer you know that you will be able to work with texts from the first moment and without having to go through the license box or having to download any alternative opensource.

With TextEdit you can compose texts with ease. What's more, you can do it in HTML. On the other hand, TextEdit is capable of displaying documents in Word or OpenOffice format. However, if you really dedicate yourself to joining letters, surely you are missing a function that is available in other processors: the word counter. TextEdit lacks this source function. However, thanks to MacWorld let's create a script so you can carry out the task.

Create TextEdit word counter first step

First thing: launch Automator. This one is in Finder> applications and you will have to search the long list. Once launched, it will ask you what type of document you want to create. We will select "Service". You will see that suddenly another window appears on the right side of Automator. There you should indicate that the service receives the "text" selection and that it will be used in the "TextEdit" application. (These steps are shown in the screenshots)

Create word counter for textEdit second step

create word counter for TextEdit third step

Next, on the left side of the screen, you will have to select "Library" and look for the option "Run the Shell script". Again a dialog box will open on the right side of the screen and here we must copy and paste (everything as it is) the following text:

osascript << - AppleScriptHereDoc
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
AppleScriptHereDoc

Create word counter for TextEdit fourth step

Create word counter for TextEdit fifth step

Once glued on the box, We will only have to go to the Automator menu bar and in "File" click on "Save". It will ask you to give the script a name. We have dubbed it "Word Counter". And voila, you have the operational function. For this to work you must always select the text and click on the right button of the mouse where the function will appear in the last menu option.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Maria said

    I did not get the word counter. It gives me an error: The action "Execute the shell script" has encountered an error: "17:18: syntax error: Expected key expression, property or form, etc. but unknown identifier found. (-2741) "

    1.    Antonio said

      EXACTLY THE SAME happens to me too ...

    2.    cris said

      osascript << - AppleScriptHereDoc
      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
      AppleScriptHereDoc

      1.    José said

        You're very big! Thank you very much!

  2.   Carmen said

    It doesn't work for me either ... too bad