I Can Just Hear The Old Soldiers Now | Main | Multnomah County Passes Antiwar Resolution

January 30, 2003

Yay Shell Posting!

Posted by Mike on January 30, 2003 12:15 AM

New tools are always fun. mtsend.py is a Python script for command-line posting to Movable Type 'blogs. You just edit a plain text file then feed it to the script. It also does basic 'blog info retrieval. I'm working on some scripts to use with the Mac script menu and BBEdit.

For starters, I guess, here's an AppleScript that dumps the contents of BBEdit into a tmp file then pipes that through the script (which requires, unfortunately, piped text and a specified operation via a switch):

tell application "BBEdit"
  save front window to "Macintosh HD:Users:mph:.blog.tmp"
  do shell script 
  ("cat /Users/mph/.blog.tmp | /Users/mph/bin/mtsend.py -N")
end tell

display dialog "Entry Uploaded"
buttons("OK")

mtsend.py also offers the ability to retrieve a list of categories, recent entry numbers, and a few other things, all of which are pretty good candidates for a little editor-centered automation.