Fetch and Push Notes from Dropbox - the poor man's sync

October 25, 2013
Updated on: October 26, 2013 at 16:00

Fetch and Push Notes from Dropbox - the poor man's sync → via @_patrickwelker

Dropbox is indispensable on iOS. Apps like 1Writer with it’s support for creating folders and Launch Center Pro for iPhone which supports browsing your Dropbox and opening files are ready make working on your files a bliss.

Usually working with these apps is enough, but when I have a longer writing project I’d like to have a shortcut to open that particular file in my editor of choice and if I’m done I’d like to sync the changes back. It’s definitely faster if 1Writer isn’t your default editor and the text file is in another location than the one you specified in your default editor.

So, let’s keep this short and sweet and show you these two very simple x-callback-url’s which work as a manual sync solution for single files:

Requirements: Drafts and Launch Center Pro.

Fetching a Note

UPDATE: As it turns out my URL scheme to pull a note from Dropbox with Drafts is serpentine. It’s now officially filed away under “The U-Turn”

Thankfully Phillip Gruneich - who has a deeper understanding of URL callbacks than I do - showed me a shortcut which I’m going to share here:

Version 1 – Launch Center Pro:

drafts://x-callback-url/create?text=[dropbox-text:Notes/iOS Automation.md]

Version 2 - Drafts:1

That’s it for part 1.

Dear reader, feel free to skip the U-turn subsection since it only documents how to complicate things. To jump right to part 2 press here with your mouse or finger now.

The U-Turn

(1) We use Lauch Center Pro’s new Dropbox action the specify the file whose content we want in our clipboard (here “iOS Automation.md”).

launchpro-dropbox://clipboard?path=Notes/iOS Automation.md

Just use Launch Center Pro to create the URL and it takes care of percent encoding it for you. Result:

launchpro-dropbox://clipboard?path=Notes%2FiOS%20Automation.md

(2) Next we tell Launch Center Pro to open the clipboard as a new draft in Drafts.

launchpro://?url=drafts://x-callback-url/create?text=[clipboard]

Optionally, if you don’t want to edit the file in Drafts you could use an action which sends the text to the app of your choice. I stick with drafts since I think it’s an excellent editor.

The resulting decoded URL scheme:

launchpro-dropbox://clipboard?path=Notes/iOS Automation.md&x-success=launchpro://?url=drafts://x-callback-url/create?text=[clipboard]

Complete URL scheme (encoded):

launchpro-dropbox://clipboard?path=Notes%2FiOS%20Automation.md&x-success=launchpro%3A%2F%2F%3Furl%3Ddrafts%253A%252F%252Fx-callback-url%252Fcreate%253Ftext%253D%255Bclipboard%255D

For the passing on the clipboard it’s necessary to encode the second part of the URL like outlined in the Launch Center Pro documentation. Thankfully the app also has the capability to do that for you (see LCP’s clipboard actions).

Pushing the edited Note

This has become very easy thanks to the latest Drafts update which features a replace function – no more need to bring the heavy tools (Pythonista) to the game.

Open up drafts, create a new Dropbox action that looks like this:

drafts-replace-action

Certainly not elegant or unique, but I happen to find it useful.

  1. I need to fix the code block issues with my Markdown parser. It wouldn’t display the code for the URL scheme properly. That’s way you see this nice tweet from Phil.

comments powered by Disqus

Related Posts