Twitterrific+MarsEdit Script: Blog a Tweet

Came upon the idea of making it easy to create a new blog entry in MarsEdit by quoting the currently-selected tweet in Twitterrific. Wasn’t too hard, only stubbed my toe twice (this is doing very well when dealing with AppleScript).

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 newDocument to make new document
    tell newDocument
        set body to "[" & ¬
            tweetUserName & ¬
            " / @" & ¬
            tweetScreenName & ¬
            "](" & "https://twitter.com/" & ¬
            tweetScreenName & ¬
            "/status/" & tweetID & "):" & ¬
            kReturn & ¬
            "> " & tweetText
    end tell
end tell

I had to copy the properties out of the selected tweet (t) into local variables since once I switched scopes from Twitterrific to MarsEdit, AppleScript complained about how it couldn’t access the fields. This is probably because the property names have spaces in them. Sigh.

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.

twitterrific marsedit applescript Nov 2 2009