Create Octopress Posts From LaunchBar

One of the things that’s a big kludgy when using a system like Octopress is the manner in which you create a new post and get it loaded into your favorite text editor. It sort of goes like this:

  1. Go to blog folder in Terminal
  2. Enter a command like rake new_post["post title"]
  3. Copy new path from pasteboard
  4. Type open and paste the path Octopress just gave you

One way to deal with this (in Octopress, specifically) would be to edit your “Rakefile” and change the new_post command to open the file that was just created. But since I’m on a Mac and use LaunchBar already, a more appealing option was to create an AppleScript.

{% gist 4472948 %}

What the script does is ask for the post title you’d like to use, tell Terminal to run all of the right commands to create the post and then open the most recently added document from the posts folder in your default editor. So now the steps to create a new post and start editing it are:

  1. Run the script from LaunchBar
  2. Type the post title you'd like to use

AppleScript itself is so weird and kind of crappy as a language, but I’m really glad to have it for what it can do when I want to scratch a small itch like this.

Collin Donnell @collin