jarrodwhaley.com

I make films. I'm also a nerd.

Posts Tagged ‘Drafts’:

QuickReminder 3.0

I’ve made a few more improvements. I added input prompts so that a reminder can be easily scheduled from within Pythonista, so Drafts input is now optional. I also commented the code much more fully.

As usual, you can get the script at this gist.

QuickReminder v. 2.1

My QuickReminder script for Pythonista is now at version 2.1. I improved the way that certain errors were handled, making everything a bit more friendly to the user. I’ve also made a small tweak which throws an alert when no time interval is specified, then relaunches Drafts, preserving the original reminder text.

You can always grab the newest version of the script from this gist.

A Flexible Random Number Generator on iOS

My girlfriend manages a retail store on the Web, which entails a lot of marketing via social media. She likes to run a weekly promotion on Facebook in which a prize is awarded to a randomly selected “liker”1. When she first conceived the idea, she didn’t really have a means of properly choosing a winner with any real amount of randomness2, so I thought I’d cook up a little Python script. I realized that something like this would be a handy little utility for my own purposes, and I also knew my girlfriend would be asking for random numbers with some degree of regularity. Those two conditions being the case, I decided I’d like to write something that could be easily fired from an iPhone or an iPad with minimal effort. The script below meets those requirements fairly well, I think.

more »

QuickReminder v. 2.0

I’ve updated my QuickReminder script for Pythonista to version 2.0, and it comes with a couple of cool improvements. Now, when the script begins to run, you’ll be prompted via a native iOS alert to either schedule the reminder or cancel it entirely1. The script will also return you to Drafts2 once your reminder is successfully set.

I have a lot of ideas for further improvements, so stay tuned. If you’d like to grab it, check out the gist.


  1. I’ve found on many occasions while running the script that I’d say, “oops,” and need to kill the notification so I could reschedule it, etc. 
  2. Required under my implementation, but it ought to be fairly simple to launch it with Launch Center Pro, for example. 

Easy URL Encoding on iOS

Occasionally it’s necessary to encode some text on iOS for easy insertion into a URL. It’s annoying enough trying to type out all of that word%20word%20word%20word gobbledegook, and it’s particularly painful trying to do so on an iPhone, since you have to dig down to the third keyboard in order to get to the % character. I came up with a couple of easy solutions to the problem using Drafts, TextTool, and Editorial.

  • The first method is a Drafts URL action which will send the text of the current draft to TextTool, properly encode the text for use in a URL, and then send the text back to a blank entry in Drafts:
    texttool://x-callback-url/transform?text=[[draft]]&method=encode&x-success={{drafts://x-callback-url/create?text=[[output]]}}
    
  • The second method is a workflow for Editorial which uses a Python script to replace the selected text with a URL-encoded version of the selection. Just install that workflow and fire at will.


UPDATE, 4:21 PM: Over on ADN, Jeff Mueller posted a handy permutation of my Drafts action for Launch Center Pro:

texttool://x-callback-url/transform?text=[clipboard]&method=encode&x-success={{launchpro:}}

Thanks, Jeff!

Sending Markdown to Tumblr With Drafts

I noted a while back that the Tumblr app for iOS now supports x-callback-url, and I’ve played around with various URL actions in Drafts which make use of the implementation. I find in most cases, however, it’s easier to post text-based items using Tumblr’s publish-via-email feature—it sends the text directly to a blog, without requiring a ton of fiddling in the Tumblr app along the way. This being the case, I’m sticking with a Drafts email action which sends my text posts to a blog directly, with just one tap.

Tumblr’s email mechanism is actually very well thought out, and allows for everything from tagging to categorization to titling—and you won’t have to remember any annoying syntax if you write with Drafts; you’ll just enter your template into an email action and never think about it again. One quick, indispensable tip: if you write in Markdown (and why wouldn’t you?), simply add !m to the body section of your email action, and Tumblr will automatically convert your Markdown to HTML. Give it a try. As much as I like URL actions, sometimes you just want to fire off the text without tapping around in two different apps.

QuickReminder 1.1 – Quick iOS Reminders

Thanks in large part to a suggestion from Philip Mozolak on App.net, I’ve edited my QuickReminder script for Pythonista so that it plays a short audio notification upon the successful scheduling of a new reminder. It’s a minor tweak, but I think the additional feedback improves the experience of using the script quite a bit.

If you’ve been using the original script, all you need to do in order to update is copy the contents of the gist and paste them into your QuickReminder.py file in Pythonista.

Thanks, Moze.

A Small Hack to Improve My Drafts/Hazel/DayOne Workflow For MacBook Users

Lorenzo of 24 Empty Bits has adapted my means of writing DayOne entries from directly within Drafts to his own needs, in a way which I thought my readers might find interesting. Rather than requiring an always-on Mac1, as my original solution does, Lorenzo’s version uses an AppleScript to send new entries into DayOne when a Mac wakes or is booted–thus preserving the proper timestamps for entries written while the Mac wasn’t running.

I’m sure this is a welcome hack for those who only have laptops. Thanks, Lorenzo.


  1. Well, not really, but it is true that the timestamps on entries written while your Mac is asleep will be wrong with my version. 

Link-Blogging With Drafts And Pythonista

I write about the useful aspects of both Drafts and Pythonista quite often. The fact is, these two applications (with a little help from TextExpander, naturally) make writing on iOS almost as easy as writing on a Mac. I have found a few key ways to use them to automate tasks which used to be tedious on mobile devices; my life is a lot simpler as a result.

One example–and it’s something I often use multiple times per day–is a combination of a Safari bookmarklet, a Pythonista script, and Drafts. It was developed by iOS automation-nerd Federico Viticci, and originally shared in his oft-refenced Macstories post “Automating iOS: How Pythonista Changed My Workflow“. Its inputs are: 1) text selected by the user on a Web page, and 2) that page’s URL. It passes those inputs through Pythonista, and then it shoots them over to Drafts. The output of Federico’s workflow–i.e. the new object in Drafts–consists of the user’s selected text, followed by the URL preceded by “From: “. I love it as a means of quickly getting started with a “link-blog” style post, in which a source is cited, and then a block quote is given. However, I had one small problem with the Python script: the link was injected after the block quote, and none of the output was formatted as Markdown. It just didn’t fit the way I want to write. So I tweaked it.

more »

Using the x-cancel Parameter On iOS

Eric Pramono at Geeks With Juniors has written up a very helpful tutorial on the use of the x-cancel parameter within x-callback-url actions. I haven’t made much use of x-cancel yet in my own URL actions for Drafts, but Eric makes a good case for their usefulness. Worth a read.