Dropbox Automator Service for Saving Selected Text

Always looking for new uses for Dropbox, I came across a couple of sites showing the same tip: 1) It’s All Tech’s How to automatically copy your Mac OS X clipboard to Dropbox and 2) Tip #1 in this MacOSXTutorials12 video.

What it Does

Essentially this is a way for Max OS X users to select text somewhere and then quickly append it to a text file in Dropbox. That might be a faster way, for example, to make note of things you find while web browsing. Or you might use it to add part of a PDF file to Dropbox without the extra clicks needed to create a new text document.

My Additions

I liked the tip but wanted to make a few improvements. I wanted to:

  1. Make the script work. The cat command needs two “>” in order to append instead of overwrite a file.
  2. Add date and time information to the text selection that I was appending.
  3. List the text selections in reverse chronological order, meaning that the most recent is at the top.

How to Make It

This is the Automator Service script that I used:

echo —“$(date)”— > ~/Text-Clips-temp.txt
cat >> ~/Text-Clips-temp.txt
cat ~/Dropbox/Text-Clips.txt >> ~/Text-Clips-temp.txt
mv ~/Text-Clips-temp.txt ~/Dropbox/Text-Clips.txt

Only Works in Some Applications

Unfortunately not all apps can use Automator Services. Only apps written in Cocoa, as Apple does with most of its apps, will work. This means that Safari, Mail, Preview, Calendar, and Address Book will work. Most other apps including Chrome and Firefox will not.

Side Notes

That this isn’t using the Mac OS X clipboard, as the tips I found stated. We’re selecting text and then using a service on it. The text is never copied or cut so it’s not in the clipboard.

Even though this tip is described as for Dropbox, there is nothing Dropbox specific except that the location of the text file happens to be in the Dropbox folder. Dropbox makes the service useful since you can have access to the text file from other locations. But this tip will work on any text file.

If you’re new to Dropbox, please use our Dropbox referral to set it up. It will give you an additional 250MB and give the same to us. Now Dropbox referrals will allow you to get up to 10GB for free, a great deal for your backup and sharing files needs.

What do you think?

If you have any suggestions to improve this Automator Service or to better use Dropbox, let me know.

Leave a Reply

Your email address will not be published. Required fields are marked *

*