I am most definitely a devotee of the social-networking message service Twitter. (Explaining Twitter’s appeal is the topic of another story, one I haven’t written yet.) But if you use Twitter, and especially if you use The Iconfactory’s Twitterrific for Mac ( ; free with ads, $15 without) you might be interested in discovering some of the program’s hidden features.
Before I begin, an aside: 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.
Anyway, on to the geek-out.
During the run-up to the election last year, I got really tired with seeing people use Twitter to argue about politics. Not that I’m not engaged in the political process—I vote in every election. But I find Twitter, with its 140-character limit, to be the death of nuance, and in my mind any political conversation worth listening to involves nuance. So I decided to nuke every single Tweet in my timeline that mentioned the candidates.
The good news is, I didn’t have to resign from Twitter to do this. I just used Twitterrific’s little-known text filter feature, which is accessible only via the command-line (or via a handy secret-preference utility such as Secrets). This feature uses the pattern-matching syntax used in the Unix utility
grep—read more about finding things with grep or using grep and HTML if you’re curious, or buy Jeffrey E.F. Friedl’s excellent book
Mastering Regular Expressions
to become a true grep maven. But the good news is, you don’t have to be a regular expression wizard to craft a basic Twitter text filter.
Here’s the command I popped into the Terminal last year:
defaults write com.iconfactory.Twitterrific tweetTextFilter -string "McCain|Obama"
The first portion of that command tells you that you’re setting Twitterrific’s secret
tweetTextFilter preference. The last, quoted part is the actual filter. And here’s your big piece of grep knowledge: you use the pipe character (
|) to mean “or.” So in this case,
McCain|Obama means, eliminate any tweet with the word
McCain or the word
Obama in it.
Similarly, if there’s someone who sends you messages on Twitter that you’d rather not see, but whom you don’t wish to block, you can filter those messages out via the
tweetScreenNameFilter setting, all with the same format.
defaults write com.iconfactory.Twitterrific tweetScreenNameFilter -string "dude109|guy19"
There are plenty of other hidden preferences for Twitterrific, all completely documented in the program’s accompanying Read Me file. You read it all the way to the bottom, didn’t you? Nope—didn’t think so. But let me tell you, you haven’t lived until you’ve turned on
Scripting your tweets
Want to annoy people with Tweets sent out automatically via an AppleScript? You can do it! After all, I have. I wrote a script that allowed me to boast to people in cold-weather climes (or, in the summer, hot-weather climes) about the wonderful weather we have here in the San Francisco area. Here’s the basic version of the script:
tell application "Twitterrific" post update "I am a stupid, scripted tweet." end tell
Seriously—that’s it. Of course, my script queries my home weather station for the current temperature, converts the temperature from Fahrenheit to Celsius, rounds both temperatures to the nearest degree, and then sticks the entire thing into one ridiculous weather boast.
Use it judiciously. People hate automated tweeting. Mine’s stored as a script I can double-click to run whenever I feel the need to lord it over people with houses much, much larger than mine because they live in places where it snows. Ha, ha! You’re in your gigantic houses watching the snow fall while I’m in my tiny… hmm. Why am I boasting again?
It’s amazing I still have any Twitter followers at all.
Scripting received tweets
You can also write an AppleScript script that will process incoming Tweets and do things with them. (There’s a sample script included in the Twitterrific archive you downloaded with the app. You opened it, right? Nope—didn’t think so.)
The other day, Bob LeVitus pointed out that he was following The Talking Moose on Twitter. For those of you who aren’t old and decrepit like Bob and I, the Talking Moose was a program for the Mac back in the old days. The Talking Moose was a character who would randomly pop up on your Mac and, using the Mac’s text-to-speech technology, say something funny or crazy. Now someone has ported the Talking Moose to Twitter, bless ‘em.
So I was struck with the idea—what if I could get the Talking Moose Twitter stream to speak out loud, in the style of the old Talking Moose? What a useless idea. But hey, I figured, if I succeed I’ll get a blog post on Macworld.com out of it. And here we are.
So here’s my script:
on process_tweet(tweetId, tweetDate, tweetScreenName, tweetUserName, tweetUserUrl, tweetUserImageUrl, tweetText, tweetType) if tweetScreenName is "TalkingMoose" then tell application "Finder" say tweetText using "Fred" end tell end if end process_tweet
That’s it. Of course, you could stack on other behaviors based on other Twitter Screen Names. I tacked on an extra set of lines to speak breaking news from breaking-news accounts that I follow. You could even get it to declare when this guy’s got clean clothes in his washing machine. It’s up to you.
I saved my script,
talkingmoose.scpt, in my home folder. Then, in order to tell Twitterrific to execute the thing, it’s time for another trip to the Terminal, to execute this command:
defaults write com.iconfactory.Twitterrific processTweetScriptPath -string ~/talkingmoose.scpt
That’s it. Quit Twitterrific and re-launch it, and your script will execute every time new tweets arrive. If one from the Talking Moose arrives—assuming, of course, you’re dumb enough to follow TalkingMoose—it will be spoken to you in Macintalk Fred, for my money the proper old-school Mac voice for the musings of the Talking Moose. (If you’d prefer your messages sound like the autopilot in the Pixar film WALL-E, use Ralph instead of Fred.)
Please note that there’s a bug in earlier versions of Twitterrific that will cause every tweet to be spoken every time a new tweet loads! Be sure to download version 3.2 of Twitterrific before running this script.
And if you do download Twitterrific, be sure to read that Read Me file all the way to the bottom. You never know what you might find.
Editorial Director Jason Snell's weather is probably nicer than yours. If you can stand it, follow him on Twitter as jsnell.