Applescript: Count Characters in Clipboard for Twitter

June 29, 2009

Every now and then I need to copy text into my Twitter client app and need to know if I am bumping against the 140 character limit.  I wrote this quick applescript to simplify my life.  It counts the number of characters in the clipboard and subtracts that number from 140, so you know if your text is too long, too short, or right on target:

display dialog (”Total characters: “ & (count (the clipboard)) & “ “ & “Remaining for Twitter: “ & (140 - (count (the clipboard)))) with title “Character Count”

The best way to use this (outside of using a third-party app that can trigger Applescripts) is to save it to your ~/Library/Scripts folder after you have enabled the Scripts Menu in the OS X menu bar, so you have access to it from any application.

  • http://freecallindia.info/ Steve Call

    Thank you for your very useful article. But I had difficulty navigating through your web site as I kept getting 502 bad gateway error. Just thought to let you know.

  • Ken Clark

    Steve–

    Thanks for the note, and I am glad this was useful to you. I will check out my web setup to see if there’s anything strange going on on my end. –Ken

Previous post:

Next post: