Find Out Who’s Replying to Anyone on Twitter with AppleScript

twitter-icon.pngWhen someone I follow on Twitter asks a question and I have a response, more often than not I would like to see who else is responding to the question and how. From what I can tell, the easiest way to do this is to search for @user responses to the questioner on Twitter Search. It is ideal by no means, but it gets me the info I’m looking for.

One of the reasons, however, why this method isn’t ideal is the sheer amount of click-copy-paste labour involved in executing the search. Here is a simple AppleScript that takes some of the mouse work out of finding responses to any user on Twitter.

Search for Replies to Any Twitter User

tell application "Safari"
	try
		if URL of document 1 contains "twitter.com" then
			set theURL to URL of document 1
			set theTweeter to characters 20 through end of theURL as string
			open location ¬
				"http://search.twitter.com/search?q=" & "@" & theTweeter
		else
			activate me
			try
				set searchTerms to text returned of (display dialog ¬
					"Couldn't get Twitter user. Want to search Twitter?" default answer ¬
					"" buttons {"no Thanks", "Search"} default button 2)
			end try
			open location ¬
				"http://search.twitter.com/search?q=" & searchTerms
		end if
	end try
end tell

How to Use the Script

Copy the script into a new Script Editor document (in Applications >> AppleScript), hit Compile and save it to your scripts folder (in ~/library/Scripts). Before you run the script, click on a Tweeter’s name in Twitter to load their recent tweets. Run the script and a new tab will open with all tweets containing that user’s Twitter handle. This way you can easily see who is responding to that user and how they’re responding to their question.

* * *

Is there a better way to find responses to Tweeters? See some way to improve my sophomore scripting? Please let me know in the comments. If you’re into it, you can follow me on Twitter as PeterVk or subscribe to MacMembrane’s RSS feed to keep up with the latest here.

Think Different?

MacMembrane on Twitter

Twitter makes an excellent venue for discussion. Tweet this post and have your say.