I’m using Overleaf for my thesis and have been pasting segments into other apps to get a word count. It’s a pain. I just activated this script to give me a character and word count on any selected text in any app* using the contextual menu. It’s great, so I’m sharing:
Open Automator on your mac.
Make a new file as a new Service
Drag Run AppleScript action to the main window
Add the code below
Save as something like ‘Selected text word count’ or ‘How many bloody words now?’
Et voila go to an app and select some text, ctrl-click and get the counts.

The instructions above are:

  • 269 characters;
  • 52 words;
  • 6 paragraphs.

*apart from Word as the devil controls all within it, but you don’t need it there anyway.

on run {input, parameters}
try
set MyText to input as string
set numChars to the number of characters of MyText
set numWords to the number of words of MyText
set numPara to the number of paragraphs of MyText
set theResult to “This brilliant text contains:” & return & “- ”
if numChars is 1 then
set theResult to theResult & numChars & ” character;” & return & “- ”
else
set theResult to theResult & numChars & ” characters;” & return & “- ”
end if
if numWords is 1 then
set theResult to theResult & numWords & ” word;” & return & “- ”
else
set theResult to theResult & numWords & ” words;” & return & “- ”
end if
if numPara is 1 then
set theResult to theResult & numPara & ” paragraph.”
else
set theResult to theResult & numPara & ” paragraphs.”
end if
display dialog theResult buttons {“OK”} default button 1 with icon note
on error errmsg number errnum
display dialog errmsg & ” [” & errnum & “]” buttons {“OK”} default button 1 with icon stop
end try
return input
end run

src:http://hints.macworld.com/article.php?story=20120428125918199