Display conversation from Twitter

2009-04-07: Updated query to search.twitter.com so that the result is more like what TwitterFon gives you when you drill down conversations.

I wrote a simple AppleScript to display the conversation history between two people in a tweet in Twitterrific.

I often want to focus on a conversation between two people in my timeline, without the distraction of all the other tweets. This AppleScript makes this as easy as selecting a tweet with an @reply, and running the AppleScript via the AppleScript menu.

All it does is, 1) get the user names of the sender and recipient of the tweet (only of @reply tweets), 2) query search.twitter.com for tweets sent from either of the user names.

tell application "Twitterrific"
	set thisTweet to selection
	set thisUser to screen name of thisTweet
	set thisPost to post of thisTweet
end tell

set thisOffset to offset of "@" in thisPost
if thisOffset is equal to 0 then
	display alert "No recipient in Tweet"
	set thisOffset to thisOffset + 1
	set newUser to ""
	repeat until character thisOffset of thisPost is equal to " " or character thisOffset of thisPost is equal to ":"
		set thisCharacter to character thisOffset of thisPost
		set newUser to newUser & thisCharacter
		set thisOffset to thisOffset + 1
	end repeat
	open location "http://search.twitter.com/search?q=from%3A" & thisUser & "+to%3A" & newUser & "+OR+from%3A" & newUser & "+to%3A" & thisUser & "&lang=all"

end if