Scripts and Tricks for Twitterrific

Twitterrific.pngRecently I read an excellent article on Macworld detailing some of the lesser know features of the Icon Factory’s Twitterrific. There are definitely some great tips here, but what resonated most from the article was Snell’s involved and almost personal relationship with the Twitterrific:

There are a lot of Twitter apps for the Mac. I’ve tried most of them, but I keep coming back to Twitterrific. Its simple interface does what I want, when I want. Some of the competitors offer interesting features, but none of them work well enough to tear me away from Twitterrific. I do have a wish-list for Twitterrific that’s about a mile long—but again, that’s another story. Despite my recognition of its flaws, Twitterrific’s the Twitter app that works the best for me.

I couldn’t agree more with this sentiment. While we wait for a power user release of Twitterrific, here are a few of my own tricks and scripts that make the little app more usable for me.

See Realtime Responses to Any Tweeter

Twitter is an excellent way to get questions answered by others who may have first hand experience with your query. Sometimes, however, it isn’t you who asks the question, but someone you follow.all-replies.png If you want to see how people are replying to everyone in your timeline you can enable this in Twitter’s preferences. To do so, go to the Notifications tab under your account settings and select Show Me ‘all @ replies’ from the drop down menu. With this preference enabled, every time one of your followees is replied to, you’ll see the reply in Twitterrific.

Personally I don’t want to see everyone’s responses – it crowds Twitterrific. But there are still times when I do want to see responses to some particular Tweeter. When that happens, I use this simple script.

tell application "Twitterrific" to set theTweeter ¬
	to the screen name of selection
try
	tell application "System Events"
		key code 53
	end tell
end try
tell application "Safari" to open location ¬
	"http://search.twitter.com/search?q=" & ¬
	"@" & theTweeter

To use the script, have the tweet selected in Twitterrific that you want to see replies to. When the script is run it will open a Safari page with all the responses to the selected Twitter user. Until Twitter provides a way to see responses to a particular tweet and not just a user, it’s the best solution I can think of.

Open Links in a Tweet Via the Keyboard

Twitterrific has fair keyboard support, but one action that always had me reaching of the mouse was opening links embedded in Tweets. This script will look for links in Tweets and open them in Safari.

tell application "Twitterrific" to set theTweet to text of selection
try
	tell application "System Events"
		key code 53
	end tell
end try

-- John Maisey -- 29 Jan 2009 -- www.nhoj.co.uk --

set myResult to {}
-- Items that you expect will be after the end of the URL.
set terminatorList to {" ", ">", ".", ",", ")", return, tab}
-- Split by 'http://" and only get the second to the last parts.
set myList to my textItemDelimiterSplit(theTweet, "http://", 2, -1)
-- Loop through list returned.
repeat with myItem in myList
	-- Loop through possible ending characters .
	repeat with myTerminator in terminatorList
		-- Split by the ending character.
		set myItem to my textItemDelimiterSplit(myItem, myTerminator, 1, 1)
	end repeat
	-- Add the result to an array.
	set myResult to myResult & ("http://" & myItem as text)
end repeat
try
	open location myResult
end try
on textItemDelimiterSplit(theText, theTID, theFrom, theTo)
	try
		set my text item delimiters to theTID
		set myReturn to text items theFrom thru theTo of theText
		set my text item delimiters to {""}
		return myReturn
	on error
		return {}
	end try
end textItemDelimiterSplit

An important note: The meat of this script was written by the very talented John Maisley, the maker of iCal Dupe Deleter. A big thanks to John for his help here. I have left his relevant in-script annotations intact.

Translate a Tweet

As I’ve mentioned before, I’m currently living in Korea and making some attempt to learn a bit of the language. To this end, I follow a few Korean speaking Twitter users. My Korean is coming along, but much of the time I still need some help from Google Translate. The following script will translate (almost) any selected Tweet in Twitterrific into English using Google Translate.

tell application "Twitterrific" to set transMe to text of selection
try
	tell application "System Events"
		key code 53
	end tell
end try
tell application "Safari" to open location ¬
	"http://translate.google.com/translate_t?text=" & ¬
	transMe & "&hl=en&langpair=auto|en&tbb=1&ie=UTF-8#"

Get the Permalink for a Tweet

Occasionally I want the permalink for an interesting Tweet and there are two quick ways to get this in Twitterrific. Firstly, you can simply click and drag the Tweeter’s user picture associated with the Tweet onto Safari’s icon. Safari will open up the permalink in a new tab. If you don’t want to bother with the mouse, however, you can use this simple AppleScript:

tell application "Twitterrific"
	set theId to the id of selection
	set scrnName to the screen name of selection
end tell
try
	tell application "System Events"
		key code 53
	end tell
end try
tell application "Safari" to open location ¬
	"http://twitter.com/" & scrnName & ¬
	"/statuses/" & theId

Make Growl Notifications of Replies to Your Tweets Sticky

Twitterrific has built in Growl support which throws up a notification whenever new tweets are retrieved in Twitterrific. If you can handle the distraction, this is the best way to keep real-time tabs on everything that’s happening in the Twitter lives of those you follow. Despite the ‘in your face’ nature of Growl notifications, however, there is also a decided transience to their usefulness. One can become quiet immune to their presence when they’re always popping up. When someone replies to me on Twitter, I want to know it. Thankfully, it’s easy to enable ’sticky’ Growl notifications for Tweets which contain replies to you.

Open up Growl’s preference pane and navigate to the Applications tab. Find Twitterrific in the list of supported apps and double click it. Under the Notifications tab, select ‘Reply Arrived’ and set Stay on Screen to ‘Always.’ You can even add a sound to the notification if you like. With Growl set up this way, each time someone replies to you in Twitter that Tweet’s Growl notification will stick around until you intentionally dismiss it.

growl-twitterrific.png

* * *

My favorite way to run AppleScripts is FastScripts, which allows you to add keyboard shortcuts to scripts and limit their scope to application sensitive contexts. If you have any trouble with any of the scripts here let me know and I’ll see what I can do.

You can follow @PeterVk on Twitter (that’s me) or @MacMembrane to receive links to all the latest posts. If you have any of your own Twitterrific or Twitter tips post them in the comments for everyone to see. Happy Tweeting.