Last year I wrote a script (original, improved) which posted the selected tweet to MarsEdit from Twitterrific via AppleScript.
Here’s the same script, but I switched out Hibari for Twitterrific and JSTalk for AppleScript:
var t = [[JSTalk application:'Hibari'] selectedTweet];
var output = '['+t.name+' / @'+t.screenName+']'
+'(https://twitter.com/'+t.screenName+'/status/'+t.tweetID+'):\n'
+'> '+t.tweetHTML;
var marsEdit = [SBApplication application:'MarsEdit'];
var firstDocument = [[marsEdit documents] objectAtIndex:0];
var input = [firstDocument selectedText];
if ([input length] > 0) {
input += '\n\n';
}
output = [input stringByAppendingString:output];
[firstDocument setSelectedText:output];
I call [input stringByAppendingString:output] instead of just writing input + output due to what looks like an interaction bug between JSCocoa and Scripting Bridge.
It appears Scripting Bridge attribute proxies representing empty strings get concatenated as '0' instead of ''. Calling stringByAppendingString: works-around the bug.
Another thing is that MarsEdit doesn’t seem willing to execute a .jstalk file even after I set its executable bit — it assumes it’s an AppleScript and dies with a syntax error. So instead I invoke the script via FastScripts, which has no such problem.