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.
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.
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. ↩
Required under my implementation, but it ought to be fairly simple to launch it with Launch Center Pro, for example. ↩
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:
The upgrade to 10.9 Mavericks has been mostly free of headaches for me, with one notable exception–Apple quietly updated Ruby to version 2.0, which has unfortunately resulted in some broken scripts that I depend on every day. Even more unfortunately, I don’t really know much about Ruby. I’ve tweaked other people’s code to my liking here and there, but there are a lot of things about it I just haven’t yet had the time to learn about. This combination of circumstances left me with a bunch of broken workflows and no idea how to fix them.
I got a chance to do a little searching this weekend, and I finally found the tip I was looking for thanks to a search on app.net; all one has to do in order to use Ruby 1.8 is to employ the following shebang in one’s scripts:
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.
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.
Well, not really, but it is true that the timestamps on entries written while your Mac is asleep will be wrong with my version. ↩
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.
I keep almost the entirety of my life in plain text files–notes, ideas, to-do lists, movies I want to watch…pretty much anything that can be stored in text. It’s easy to find things when I need them with a search in Alfred or nvALT, and I know that my data will be safe for the long haul; plain text has been around as long as computers have existed, and it isn’t going anywhere. I do, however, like to back up all that data both locally and remotely, and Evernote does a great job of that. I also like to automate the process, so that I don’t ever have to think about any of this.