Matteo Agosti

Software engineer

Automatic Screen Shot Sharing With Dropbox and Automator

After long time using various utilities to automatically share my screen shots when I updated to Montain Lion I had to find another solution as many of them stopped working. It came to my mind that OS X is bundled with Automator, an extremely powerful utility that I always relegated to thumbnails generation. So I decided to give it a try and I eventually made it. That’s how I did.

First, fire up Automator, create a new folder action and associate it to the Desktop, as that is the place where screen shots captured with the 3 fingers key combo are stored.

Screenshot of a folder action for desktop

Add the Filter Finder Items action to select only images whose file name starts with Screen Shot (if your installation is not in English you may have to replace Screen Shot with the translated version)

Screenshot of a folder action for desktop

Add the Move Finder Items action to move previously selected files to your Dropbox public folder

Screenshot of a folder action for desktop

Now the tricky part, add a Run Shell Script action, selecting as argument in the Pass input option and adding the following code:

url=${dropbox}$(basename $1)
encodedUrl=`echo $url | sed 's/ /%20/g'`
echo -ne ${encodedUrl} | pbcopy
afplay /System/Library/Sounds/Glass.aiff 

Replace XXXXXX with your Dropbox user id. To find it, just copy the URL of one of your public files (right-click/control-click a file in your Dropbox public folder, then choose from the menu Dropbox > Copy Public Link and paste it somewhere)

Screenshot of a folder action for desktop

Now save the folder action, close automator and have fun!

If you want to discuss about this article, I'm @matteoagosti on Twitter.