One of the things I used to love about doing all of my writing in TextMate was publishing directly to this site using the “blogging” bundle. iA Writer is a better writing app than TextMate, so the tradeoff when I switched seemed fair, but I still get annoyed every time I copy and paste the latest post into MarsEdit.
This is further complicated by linked-list style posting: When I did *Daring Fireball* style linked lists, with one-line comments, it was easy to quickly post a link with a pull-quote by hitting `CMD+1`. That shortcut dumped all the data I grabbed into MarsEdit. But it sucks for my Kottke-style links where I try to write a bit more — often not in the same sitting.
Bottom line: My most irritating workflow problem *used to be* the amount of copying and pasting going on just to post something to this site.
That’s now changed.
## The Research
The biggest stumbling block was getting the text to WordPress from Writer. I found ways to do it via PHP, Python, and a command line interface — but none of these were solutions that I could figure out, or wanted use. Additionally these solutions require detailed documentation to reinstall, should I start on a fresh computer. ((This is something I have recently done, so I’m a bit sensitive to it.))
I wanted something easier. Actually I wanted an AppleScript that would send the post, but I’ve yet to figure that out.
MarsEdit was out of the running due to it having categories under check boxes that I can’t easily set using the keyboard.
Welcome back TextMate, old friend.
## The Macro

You can see the macro on the side there. It’s not overly complicated, just lots of actions.
Here’s what the macro does (simplified):
1. Grabs the title, which it places at the top of the post, prefixed with a `#` and followed by a carriage return.
2. Grabs the body text.
3. Asks me for metadata.
4. Opens a new TextMate document and dumps all that information in, formatted for the TextMate blogging bundle.
5. Waits for me to publish the post (so I can check everything looks correct).
6. When I hit the shortcut to publish in TextMate, the post publishes. The changes to the Writer file are reverted and saved, then the windows for all the programs used are closed.
Pretty simple.
Another thing I wanted was to set the scheduled publish date, which meant adding a field in TextMate containing a correctly formatted date string. I used a TextExpander snippet to speed things up (`;bdate`).
*(Here’s the detail view of some of the actions that you may find useful. [Pause action](https://f3a98a5aca88d28ed629-2f664c0697d743fb9a738111ab4002bd.ssl.cf1.rackcdn.com/pause-km.JPG). [Meta data questionnaire](https://f3a98a5aca88d28ed629-2f664c0697d743fb9a738111ab4002bd.ssl.cf1.rackcdn.com/meta-data.JPG). [Text insertion to TextMate](https://f3a98a5aca88d28ed629-2f664c0697d743fb9a738111ab4002bd.ssl.cf1.rackcdn.com/insert-txt-km.JPG).)*
## End Result
Now I can publish from iA Writer via a series of simple actions, triggered by a single keystroke.
Because I install this macro’s only dependencies — Writer and TextMate — on every Mac I own, the solution is simple to reinstall and portable.
You can download the macro [here](https://f3a98a5aca88d28ed629-2f664c0697d743fb9a738111ab4002bd.ssl.cf1.rackcdn.com/Blog%20Post%20to%20WordPress.kmmacros.zip).