A Far More Direct Siri Blog Publishing Method

Previously I set up a Rube Goldberg method of publishing my Jekyll-based blog via Siri. Here’s a more streamlined update.

Every step in the process is a potential breaking point. Fortunately, the two biggest that were breaking on me are also fairly simple to replace. IFTTT works great, but wasn’t always real-time. Dropbox had a major outage this week that meant it couldn’t be used at all. I replaced both of them with a far more direct AppleScript:

The basic concept is the same, only now instead of creating an IFTTT rule to generate a text file on Dropbox that gets synced to my Mac mini where Hazel notices it and fires off an AppleScript …

… I have an AppleScript that checks Reminders.app directly and put it on a launchd job to check every 15 seconds, similar to the process I set up in my post Create Reminder Tasks from Email. Now I’m keying directly off of Reminders.app and have the same flexibility to add new automation tasks at any point.

Create Reminder Tasks from Email

For a while I’ve wanted to be able to add emails to whatever task manager I’m using, from any device I’m using. Currently I’m keeping things simple by using the default Reminders app for OSX and iOS, but this solution could work for any task management app that has an OSX counterpart and supports AppleScript.

I didn’t come up with this script entirely on my own, but I did customize it, alter the overall workflow, and work through some Gmail + Mavericks issues (now I’m starting to understand why Gmail’s IMAP bastardization is a real pain).

The process is pretty simple:

  1. Flag an email you want to have turned into a task
  2. Archive the email 1
  3. Go about your business

On my Mac mini I have running at home, I set up Reminders (already set up from my crazy Siri-controlled Blog Publishing post) and Mail.app with my standard email accounts configured.

The key piece is the AppleScript that takes all flagged emails, creates a Reminders task out of them, and then un-flags them. Here it is:

That will check all enabled accounts. If you want to only process one account you’ll have to modify the script a bit. You can adjust what goes in the notes field as well if you want (msgBody). I opted to copy in the text of the entire email in case I needed to reference it while I was on the go. The link to the original email is at the bottom, but that only works on OSX. I also tried to keep the From text short (and stripped out the email address) so that the display in Reminders is more readable.

To get the AppleScript running periodically to check do this task you’ll need to set it up to run via launchd or cron. I’m more familiar with cron, but it seems as though Apple leaning towards launchd and adding additional functionalities. I figured this would be a good simple task to learn launchd on so I’ll have it in my toolbelt for later on.

What you need to do is create a new .plist file in ~/Library/LaunchAgents . Mine is named com.nateofnine.FlaggedEmailToReminders.plist  and looks like this:

Now all you need to do is log out and back in and this will start executing your AppleScript every 60 seconds!

Siri-controlled Blog Publishing

Hot on the heels of setting up my markdown-dropbox-blog workflow, I realized I needed a more reliable way to regenerate and rsync the rendered files. The workflow I had set up worked fine for new articles, but not for edits to already-published articles, it assumed I wanted to publish immediately, and didn’t offer any easy way to handle any sort of failure.

What I came up with seems like the digital equivalent of a Rube Goldberg machine but it works and affords flexibility for automating other tasks as well. Besides, Rube Goldberg machines are awesome.

tl;dr – Simply hit a button or say “Siri, add refresh blog to the automation list” and sit back while your Jekyll-based blog rebuilds and republishes itself.

Continue reading “Siri-controlled Blog Publishing”