You'll need to first go to https://www.dropbox.com/developers, create a new app using the Sync API, with access to all files in your account. Once you've done that, click the link that says "generate access token". You'll need to put this in the alfred workflow script where it says `access_token = ''`. Put it between the quotes.
I've been playing around with a file action to allow you to restore previous versions of files in Dropbox. Feedback and suggestions welcome.
Please note this workflow isn't 100% complete. It's worked in my testing, but it probably isn't perfect
Features include:
- Support for personal and Dropbox for Business accounts
- viewing a diff of two files if you have FileMerge installed on your computer (from Xcode)
- Get a sharable link to a file (not related to previous versions, but still a nice to have)
Todos:
- Better errors when things don't work correctly (no FileMerge, you've revoked app access, linked the wrong account)
- Take advantage of the new shared folder API. I'm testing this in my personal workflow, but it's not ready to be shared yet.
- Support for more diff tools (Kaleidoscope, etc)
To get started:
Download the workflow here
Create a Dropbox app at https://www.dropbox.com/developer Be sure to choose Full App access, otherwise it won't work
Put the client id and secret into src/config.py in the workflow directory
To authenticate:
- Select a file that's in your Dropbox folder and choose the "Previous Versions" file action. You'll be prompted to authenticate by hitting enter.
- Once you've approved the app, run dbauth and paste the code.
Using Previous Versions:
Once authenticated, you'll be able to get the last 10 previous versions of a file through the file action
Hitting Return on any of the versions will give you the option to see a diff of the file. Note that if you don't have FileMerge installed, this will probably just silently fail.
Love this script! I have one power user suggestion. If you use the following Applescript, you can do more than just add items to your inbox:
on alfred_script(q)
tell application "OmniFocus"
tell default document
parse tasks with transport text q
end tell
end tell
end alfred_script
This will allow you to add items using the following syntax: