Piseth Mao asks:
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.
Browser: Safari 6
System: Mac
Tagged: applescript, automator, mac software, search tips, software tips
System: Mac
Tagged: applescript, automator, mac software, search tips, software tips
2 Answers - Write an Answer
Jan Fritsch
December 24, 2012I 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/
ha14
December 24, 2012Use 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.