Byword Previews in Marked 2 with AppleScript

I’m a big fan of both Byword and Marked 2. The Sweet Setup recently declared Byword to be their favorite Markdown writing app and deservedly so. While Byword does offer a Markdown preview to quickly ensure everything is formatted correctly, its functionality is limited. Marked on the other hand is a Markdown processing powerhouse. It offers many advanced options to both preview and export HTML such as MultiMarkdown and GitHub Flavored Markdown. If you maintain a blog it’s the best $14 you’ll ever spend. I wrote an AppleScript that allows me to author posts in Byword and automatically preview them in Marked with a simple hotket. I use command + shift + m.

tell application "Byword"
    activate
    set the_document to document 1
    save the_document
    tell application "Marked 2"
        set the_file to the_document's file
        open the_file
        activate
    end tell
end tell

I use Keyboard Maestro to invoke the script but FastScripts and Alfred can both do the job. Conveniently, it will automatically prompt you to save the file in Byword if you’re working on a brand new document. Once saved, invoking the script again will provide the desired result. If you’re an iA Writer fan1 the same script will work by simply replacing the reference to Byword with iA Writer.

  1. Which I’m not, long story. ↩︎