-- Word and Character Count service for Mac OS X | |
-- Adds a Word and Character Count option to the text selection context menu | |
-- Use Automator to create a new service, then select the Run AppleScript action. Make | |
-- sure the service is set to receive "text", at the top of the window. Paste in this code | |
-- and save as "Word and Character Count". Now switch to a new app, select some text, | |
-- right-click, go to Services, and find the new option. | |
-- Copyright 2015, Noah Slater <nslater@apache.org> | |
-- Copying and distribution of this file, with or without modification, are permitted in | |
-- any medium without royalty provided the copyright notice and this notice are preserved. | |
-- This file is offered as-is, without any warranty. | |
on run {input, parameters} | |
tell application "System Events" | |
set _appname to name of first process whose frontmost is true | |
end tell | |
set word_count to count words of (input as string) | |
set character_count to count characters of (input as string) | |
tell application _appname | |
display alert "" & word_count & " words, " & character_count & " characters" | |
end tell | |
return input | |
end run |
This comment has been minimized.
This comment has been minimized.
You're welcome! |
This comment has been minimized.
This comment has been minimized.
awesome thanks |
This comment has been minimized.
This comment has been minimized.
Thank you this is very helpful! After this I went to Services Preferences and made a new shortcut for this which simplifies it just that little bit more |
This comment has been minimized.
This comment has been minimized.
That worked beautifully. Thanks for sharing. |
This comment has been minimized.
This comment has been minimized.
Very useful bit of script, saves me having to copy and paste text into an editor every time I need to write a constrained amount in an email or web form. Thanks a lot! |
This comment has been minimized.
This comment has been minimized.
Running 10.6. When I run it in Automator, I get the word and character count, but in any other app I get an error: "The action “Run AppleScript” encountered an error." |
This comment has been minimized.
This comment has been minimized.
@scienceandpoetry hmm, that's strange. It works for me. If you have a patch, let me know, and I'll update the code. Or if have steps to reproduce, share them, and I'll try to patch myself. |
This comment has been minimized.
This comment has been minimized.
Thanks for this, Noah! Very helpful. |
This comment has been minimized.
This comment has been minimized.
Thank you! |
This comment has been minimized.
This comment has been minimized.
Awesome. Thanks! |
This comment has been minimized.
This comment has been minimized.
Great, thanks! |
This comment has been minimized.
This comment has been minimized.
This is great, thank you! |
This comment has been minimized.
This comment has been minimized.
The code is 54 words, 386 characters :) |
This comment has been minimized.
This comment has been minimized.
Nice job! :) |
This comment has been minimized.
This comment has been minimized.
Just what I need x times a day and always ended up using a text editor, thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! Very usefull |
This comment has been minimized.
This comment has been minimized.
Very nice. Thanks. |
This comment has been minimized.
This comment has been minimized.
This is awesome, thank you! |
This comment has been minimized.
This comment has been minimized.
Cool! Thanks |
This comment has been minimized.
This comment has been minimized.
Excellent! Thanks for the code and the detailed instructions. |
This comment has been minimized.
This comment has been minimized.
Thanks! I use this for checking simplicity of my writing. I added some very messaging to make rough sentence count and speaking time more accessible. |
This comment has been minimized.
This comment has been minimized.
So, nice and simple - thanks for sharing! |
This comment has been minimized.
This comment has been minimized.
Hi Love the Script, been using it for sometime now, just today came across a problem, the script stopped working & i get the following error messages: |
This comment has been minimized.
This comment has been minimized.
Awesome, thank you! |
This comment has been minimized.
This comment has been minimized.
This is great, thank you! Two suggestions: |
This comment has been minimized.
This comment has been minimized.
Thank you for this! Your instructions were perfect for someone who is not super technically savvy. |
This comment has been minimized.
This is so great. I've needed this and was going to write myself a Chrome add-on, but I realized I needed it in the Creative Suite, as well. Thanks!