Dropbox SnowLeopard Service
Sep 30
Post to Dropbox Service
Author: Oliver Stengele (kamikaze28)
Description
Requires Mac OS X 10.6 Snow Leopard
These services will appear in every contextual menu of files. You are now just 2 clicks away from posting something to Dropbox!
Usage Instructions
INSTALLATION
- Drag ‘Move to Dropbox.workflow’ and/or ‘Copy to Dropbox.workflow’ to
~/Library/Services/
Open the workflows in Automator and edit the Python script (in the block ‘run shell-script) Change value of
dropboxID = '<DROPBOX-ID>'
To your ID. For example, look at the download link at the bottom of this page – you can see my Dropbox-ID there:
http://dl.getdropbox.com/u/7925/Post%20to%20Dropbox.zip
Just look at one of your public links to find your Dropbox-ID.
USAGE
- Right-click on a file or folder (in Finder, Mail, …) and select ‘Move/Copy to Dropbox’ from the contextual menu. Files will be put into your Dropbox public folder, auto-synched and the URLs to these files will be put in the clipboard. In the case of folders, there will be URLs to all the files it containes in the clipboard. Files of the same name will not be replaced. If you want to change this, you can edit the ‘Move/Copy Finder items’-block in the workflow (there is a checkmark to enable ‘overwrite existing files’).
SOURCE CODE
- Here is the Python script, that converts files and folders into the public links.
import os, sys, string, urllib # Enter your Dropbox ID here. If a public link form you looks like # http://dl.getdropbox.com/u/7925/Post%20to%20Dropbox.zip # your Dropbox-ID is 7925 and this line has too look like this: # dropboxID = '7925' dropboxID = '<DROPBOX-ID>' listOfFiles = [] for count in range(1, len(sys.argv)) : #for all input arguments if(os.path.isdir(sys.argv[count])) : # if it is a directory for root, dirs, files in os.walk(sys.argv[count]) : #traverse it for file in files : #and for every file if(not file.startswith(".")) : #if it isn't a hidden file currFile = root + os.sep + file # compose the path listOfFiles.append(currFile) # and add it to our list if(os.path.isfile(sys.argv[count])) : # if it is a file if(not sys.argv[count].startswith(".")) : #if it isn't a hidden file listOfFiles.append(sys.argv[count]) # just append it to the list pasteURLs = ''; for count in range(0, len(listOfFiles)) : # for all elements in our list components = string.split(listOfFiles[count], os.sep) # seperate the path localDir = string.join( components[5:], os.sep ) # cut off the beginning localDir = urllib.quote(localDir) # convert it to a URL (' ' -> '%20', etc.) #construct the URL finalURL = 'http://dl.getdropbox.com/u/%s/%s' % ( dropboxID, localDir ) if len(pasteURLs) > 1: # if this is not the first URL to be added pasteURLs = pasteURLs + "\n" # insert a line break pasteURLs = pasteURLs + finalURL; # add the current URL to the string os.system( "echo '%s' | pbcopy" % (pasteURLs) ) # put the string into clipboard
Links
Download http://dl.getdropbox.com/u/7925/Post%20to%20Dropbox.zip
Twitter
Facebook
RSS

