Where can I find a script for Automator to count selected text?

Piseth Mao December 24, 2012
Pinterest Stumbleupon Whatsapp

Can anyone share with me the script for Automator to count selected? I want to create an Automator service to count selected text, but I found out there is no available action from the list. I would very much thank you for sharing this script with me. Thanks.

Ads by Google

  1. ha14
    December 24, 2012 at 5:15 pm

    Use AppleScript to count words and characters in text
    http://hints.macworld.com/article.php?story=20070730101510623

    nslater / Word and Character Count.scpt
    https://gist.github.com/1616556
    Use Automator.app to create a new service, and then select the Run AppleScript action. Paste this code in to the text box, and save as Word and Character Count. Now switch to a new app, select some text, and open the context menu to find the new option.

  2. Jan Fritsch
    December 24, 2012 at 8:39 am

    I don't think you can do this with Automator alone ~ it merely enables you to automate a batch of tasks, create a workflow for things you'd usually do via the menus.

    You'll need to save the selected text to a string and then forward it into a script (bash, AppleScript, perl) which will then do the counting.

    two examples:
    http://myblogsg.com/textedit-word-count/
    http://www.cultofmac.com/166707/count-words-characters-and-paragraphs-with-a-roll-your-own-automator-service-os-x-tips/