Created
August 2, 2011 00:42
-
-
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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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