Sharing text with Drafts & Pythonista - Part 2

Sometimes when you come up with a solution, someone else has already found a more elegant solution. Case in point, my recent post on sharing text between Drafts and Pythonista. Shortly after sharing the post I got some feedback on the post and ultimately a tweet from the sensei of scripting himself:

@mygeekdaddy You can pass text back and forth without using the clipboard:

— Dr. Drang (@drdgrang) February 16, 2014

Digging into the link @drdrang included in his tweet, I found it was a post he made about the same topic back in August. As I read through his post he noted that the origin of his solution actually came from @hiilppp and a gist that hiilppp had posted a while back on GitHub.

As shown above, the script shows the basic syntax of using Pythonista’s &argv=[[draft]] action to pass text from Drafts, then using sys.argv to read the text block from Drafts into the python script and then using a shortened x-callback-url to pass the modfied text back to Drafts. It’s short, it’s elegant and it gives me the big red button I wanted.

So does this invalidate my solution?

Hell no!

My original solution ultimately boiled down to what I’ve used in my scripting and what works for me. If I learn something new along the way, which I did in this case, I can take that little nugget and use it again down the road. Dr Drang is absolutely correct that the sys.argv method he and hiilppp shared is a cleaner way to manage text between Drafts and Pythonista. The comments1 I received on the post tried to intimate that a solution that works, but is not the the best solution available, should never be shared is just plain ridiculous.

  1. I have no issue posting comments that contradict or offer opposing viewpoints to my own. Calling me an idiot (or worse) will get your comment deleted and your IP address blocked.