Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrew8088/1119352 to your computer and use it in GitHub Desktop.
Save andrew8088/1119352 to your computer and use it in GitHub Desktop.
This AppleScript (for use in Keyboard Maestro) will copy the file selected in the Finder to your public dropbox folder and copy the public link to the file to your clipboard. Don't forget to change The XXXXXX to your public "ID".
-- Add file to Dropbox Script
-- Andrew Burgess, modified a bit from http://www.bencardy.co.uk/blog/dropbox-applescript/
-- You'll have to change the first part of your Dropbox URL, in the filePath variable
-- Also, make sure the myPath variable points in the right direction
on splitText(delimiter, someText)
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to delimiter
set output to text items of someText
set AppleScript's text item delimiters to prevTIDs
return output
end splitText
set myPath to (path to home folder) as string
-- First thing: if your Dropbox isn't in ~/Documents/Dropbox, change this:
set myPath to myPath & "Documents:Dropbox:Public:"
tell application "Finder"
set theFile to the selection as alias
duplicate theFile to folder myPath
end tell
set fileName to item (count splitText(":", theFile as text)) of splitText(":", theFile as text)
-- Second, you need to change the first string below to your Dropbox URL,
-- it should be the same for all your public files.
set filePath to "http://dl.dropbox.com/u/XXXXXX/" & fileName
tell application "Finder" to set the clipboard to filePath as text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment