Dropbox

hi,
Using the ability to create Service with Automator in Snow Leopard, I’m looking for a way to copy the link of a file copied to Dropbox/Public folder (“Copy Public Link”). If you’re familiar with Dropbox you’ll understand what I mean.

I can get a compressed copy of a particular file, move it to Dropbox/Public and then get Finder to take me there, but I miss the crucial last part of the process to get a perfect automated workflow: copying its Public Link.

Looking at how popular Dropbox is and how often this procedure could be used daily, I’m sure a solution would help many of us!
Thanks

Attach this folder action to your Dropbox public folder. Edit the first line in the script to your dropboxID which you can find in any of your Dropbox public URLs.
With this script, everytime an item is dropped in the Public folder of Dropbox, the URL will be copied to the clipboard.

property dropboxID : 000000
on adding folder items to thisFolder after receiving theItems
	try
		repeat with aitem in theItems
			set aitem to aitem as text
			
			set theoff to offset of "Public" in aitem
			set thepath to text (theoff + 7) thru -1 of aitem
			
			set thepath to my processpath(thepath)
			set the clipboard to thepath
		end repeat
	on error e
		tell me to activate
		display dialog e
	end try
end adding folder items to

on processpath(thepath)
	set AppleScript's text item delimiters to ":"
	set thepath to text items of thepath
	set AppleScript's text item delimiters to "/"
	set thepath to thepath as text
	set AppleScript's text item delimiters to " "
	set thepath to text items of thepath
	set AppleScript's text item delimiters to "%20"
	set thepath to thepath as string
	set AppleScript's text item delimiters to ""
	set theurl to "http://dl.getdropbox.com/u/" & dropboxID & "/" & thepath
	return theurl
end processpath

Brilliant mate!

Just a note though: Dropbox has managed to buy the domain for www.dropbox.com so the URL within your script must be corrected accordingly: replace “getdropbox” by “dropbox”. But that’s a detail.

Thanks again.