23.5.06. Post to MarsEdit from QuickSilver, using Markdown

This is an AppleScript I cobbled together real quick to post to this weblog quickly from QuickSilver, using MarsEdit to handle the posting. I don’t claim to have any real in-depth knowledge of AppleScript, and I doubt this will win any “prettiest” or “best” code awards. I just thought it might be helpful to others.

    using terms from application "Quicksilver" 
        on process text ThisClipping
            my SendToMars(ThisClipping)
        end process text
    end using terms from

    on SendToMars(IncomingString)
        set mdcommand to "/opt/local/bin/Markdown.pl " 
        set webtext to do shell script "echo " & quoted form of IncomingString & " | " & mdcommand
        tell application "MarsEdit" 
            make new post window
            tell post window 1
                set body to webtext
                send post to weblog
            end tell
        end tell
    end SendToMars

Any text formatter could be used here – I went with Markdown for this situation as it seems to be the best fit for the tiny little text window you get with QuickSilver.

To install, I put this in Library/Application Support/Quicksilver/Actions inside my home folder under the name Post to Griddle. Any text typed can then be posted immediately. Your mileage may vary, depending on your MarsEdit configuration.