[IMPROVED] Twitterrific+MarsEdit Script: Blog a Tweet

About a month back I wrote and posted an AppleScript that makes it easy to blog up a tweet. I wrote:

I haven’t used the script yet, and may never. It’s more an interesting experiment to have it lying around to see if it comes in handy.

Turns out it’s very handy, and I’ve made great use of it.

But it’s been annoying that the script creates a new blog posting each time it’s invoked, so I tweaked it to just inject the quoted tweet into the frontmost document. Enjoy:

property kReturn : ASCII character 13

tell application "Twitterrific"
    set t to selection
    set tweetScreenName to screen name of t
    set tweetUserName to user name of t
    set tweetID to id of t
    set tweetText to text of t
end tell
tell application "MarsEdit"
    set input to selected text in document 1
    set output to "[" & ¬
        tweetUserName & ¬
        " / @" & ¬
        tweetScreenName & ¬
        "](" & "https://twitter.com/" & ¬
        tweetScreenName & ¬
        "/status/" & tweetID & "):" & ¬
        kReturn & ¬
        "> " & tweetText
    if length of input > 0 then
        set output to kReturn & kReturn & output
    end if
    set (selected text in document 1) to input & output
end tell

twitterific marsedit applescript Nov 29 2009