I must apologize if some of my followers received email notifications for some non-existent posts today. I’m working on automating the posting process from my Mac and I’ve encountered a glitch in the system. No matter what status I set a post, an immediate notification email is sent out 1. On the other hand, I’m almost there, which is kinda cool.
When my primary writing tool shifted from my MacBook Pro, to my iPad Pro, a couple of years ago I set up an WordPress workflow using the excellent Workflow app. It sped up the posting process so much it made blogging from my MacBook feel archaic. With the arrival of Scrivener 3, however, I’ve begun splitting my writing time between iPad and my MacBook. So I’ve been exploring automation options to make posting from my Mac feel less archaic.
MacOS includes a utility called “Automator,” which served as an inspiration for the Workflow app. It’s very powerful, but it also lacks any sort of plugins for WordPress 2. This made it unusable for my needs. Or so I thought.
WordPress has an option to post by email though a private email address, and this feature allows for shortcodes to set values for a post’s title, category, tags, excerpt, and even status 3. I’ve toyed around for the past several days 4 and think I’ve come up with a automation process which meets my needs.
First, I created an Automator folder action, which becomes active anytime a new file appears in a designated folder 5. Now, when I compile my latest post from Scrivener and into that folder 6 the file is opened in textEdit, the contents passed on through the workflow, and then textEdit is quit. This was the easy part.
More difficult was taking the content of my blog post and appending information like the post title, tags, categories, and excerpt. For this I used another one of Apple’s under utilized tools, AppleScript. This scripting language is easy to read, fun for tinkering, and very powerful. An AppleScript can also be called from within an Automator workflow, which made it ideal for my needs.
Once my workflow closes textEdit I am prompted with several dialog boxes. The first asks for the post title 7, the second asks for a category 8, and the third asks for tags. The results of each of these dialogs is saved to a variable, which the script then uses to compose a new email.
I could send the message without having to look at it, but I decided I’d like to be able to do a final proof on the draft. This allows me to make any changes I’d like, but it also affords me the opportunity to add an excerpt by copying a bit of text from the main post. Once I hit send, the post is included on my blog as a Draft. From there I can apply a featured image, do any final edits, and schedule my post. It’s fast, streamlined, and handles a good portion of my work for me. When I begin writing my next Fiction Tuesday novel I could even create a second folder action with settings specific to that story.
I’m quite excited by the prospects. In fact, I published this post using the workflow I describe. But I’m also not certain I’ll be leaving the “post via email” feature enabled. Anyone who spies out my private email address could flood my blog with spam posts. This is a prospect I do not relish 9.
- I’m hoping this message it sent only as an alert for me, which would make sense, but there’s no indication this is the case in the resulting inbox message. ↩
- This is not Apple’s fault, developers have to create their own ties to Automator. ↩
- Among a host of other features ↩
- Tinkering is what I do when I’m too tired to write, but my brain requires a creative outlet. ↩
- In my case, I created a “blog posts” folder on my desktop. ↩
- Using Markdown as the compile option. ↩
- I’d like to get this to be applied using a filename so I don’t have to type it out, but I’m not quite there yet. ↩
- It’s unfortunate, but I don’t think I can create a check list of common categories to be selected, so I have to type it out. The same is true for tags. ↩
- It also doesn’t like Markdown by default So I have to cut the text from the “visual” editor, and then past it into the “Text” editor in order for my markup to work. This is less than ideal. ↩
Very interesting! I know Automator has some real power and I set up a few simple things in the past. I would play more with it but my iPad works well for me.
I’m a bit disappointed with the email to post feature, so I turned it off. But it was a good exercise, and I’ve begun a Lynda course to brush up on my AppleScript. I may be able to rig something up. I’d REALLY like Workflow to come over to MacOS, though. Automator is cool, Workflow is better.
Well Apple hired the workflow team so…
They actually bought Workflow in it’s entirety!
True, but I wanted to stress the team of people are working there. So they didn’t just buy the app but the people and the app (hence its free).
True.