When a client sends in an completed ad to the Fusion mailbox, they include the accompanying text that sits beside the ad graphic. Because we allow a max of 80 characters, care has to be taken to ensure that there is no more than 80 characters included. It sounds obvious, but from time to time, a customer forgets the limit.
And so there are many times when I’ve eyeballed the text and thought, “That looks a little large.” At this point, I have no desire to squint at the screen and count characters. Normally I would copy and paste the text into another app, such as MarsEdit or WriteRoom. Apps such as these have the ability to give you a character count, which is great when you are writing and already using the app.
But it was enough of an inconvenience to me to have to open one of these apps to paste the text into. When I’m in the middle of an email session, those apps are never open. What I needed was a way to simply select any block of text, hit a key combo, and get a message with the text stats I desired.
Ah, the joy of being a Mac user …
System Services
Applescript is definitely a little weird and quirky, but it’s also flexible. A quick search on the Net found the following script by Rob Griffiths:
set myWords to count words of (the clipboard)
set myParas to count paragraphs of (the clipboard)
display dialog “Characters: ” & myCount & ”
Words: ” & myWords & ”
Paragraphs: ” & myParas
This would be best to create as a system wide service, accessible via a keyboard shortcut. I created one right away in Automator and it worked okay. But I first had to copy the text to the clipboard since the script accesses the text from there. Typing CMD + C is not a big deal, but it still felt awkward and unneccesary.
To get around this, I had to add the following Apple code to Automator:
tell application “System Events” to keystroke “c” using command down
return input
end run
This would not work within the same script that calculates the text statistics — it had to be added separately. Here’s how the service looks in its entirety.

And this is the result:

This is why I love being a Mac user. Solving your own problems is often possible, and usually fun.
-
botsmack liked this
-
gean liked this
-
markdicristinaa liked this
-
aesdesign liked this
-
ericalba liked this
-
deux-echarpes liked this
-
folberth liked this
-
rsears liked this
-
dasch liked this
-
chrisbowler posted this