I’ve been using Twitter for a while now, and I’ve just started doing ‘global’ status updates across Twitter, Facebook, and my instant messenger account statuses for iChat and Adium. Usually I use MoodBlast, a really nice application which lets me use a global keyboard shortcut to quickly enter a tweet and hit enter to update everything simultaneously.
However, if I want to update from, say, Twinkle on my iPhone (side-note: Wow, Tapulous need to do some serious SEO – their Twitter site isn’t even on the first page of Google hits. I’m on the first page of Google hits for it, ferchrissake) the sync won’t happen. This Ruby script will do the trick.
Download: Sync Status With Twitter
To use it:
- Extract the .rb file to ~/Library/Scripts
- Open it in, say, TextEdit and edit ‘Username’ at the top of the file to match your username
- Open Terminal (in Applications, Utilities)
- Make the script executable: chmod +x ~/Library/Scripts/sync-status-with-twitter.rb
- Open your crontab: crontab -e
- Add a line to crontab to run the script regularly:
- Press ‘o’ to insert a new line
- Paste the following line:
*/30 * * * * ~/Library/Scripts/sync-status-with-twitter.rb
The ‘30’ here means run every 30 minutes. Change it if you want. Some alternatives are:*/10 * * * *… – Every 10 minutes 0 * * * *… – Hourly, on the hour 0 */2 * * *… – Every second hour, on the hour
- Press escape to stop editing
- Hold down shift and press ZZ (Z key twice) to save and quit
- You’re done. Wait a little bit and it’ll update, or if you like, run it immediately from Terminal (~/Library/Scripts/sync-status-with-twitter.rb).
If you want to update Facebook too, you have two options: Either use the excellent Facebook plugin for Adium (comes with the latest version), and it’ll happen all by default [Edit: Looks like I'm wrong; Adium won't update Facebook] , or add the Twitter application to Facebook itself.
This script was inspired by a similar script by John Nunemaker over at RailsTips.org. Thanks, John.
Update: Bed has made some changes which will ignore @reply messages.
Update: I’ve also added an implementation to ignore @reply messages
Update: I’ve added a provision to only update the status if you’re not set as away – if you’re away, the status message will remain unchanged.
Related posts
- Facebook News Feed RSS A PHP script to crawl the Facebook news items and...
- DIY Twitter image hosting Twitter doesn’t yet come with its own inline image support,...
- TVSync syncs your TV episodes with iTunes and your iPod or iPhone I’ve just created a glorified bash script that will...
- Keeping Flickr away from iPhoto How to edit iPhoto's back-end files to forcibly remove Flickr...
- Google Gears issues If you’re running (or trying to run) Google Gears under...
15 Comments
Thanks for the script – very useful! FYI I’ve done a small mod to ignore @reply tweets, see http://abednarz.net/wp/twitter-adium-status-syncing-ignoring-replies/.
Great idea, Bed; I might integrate your changes, if you’re okay with that!
Of course! There may be a more ruby-elegant way to do it, this was my first experience with it.
Thanks, works perfect! And what’s the procedure to stop the syncing? Just in case…
so i mean, how do you stop the crontab-thingie? Thanks!
You open Terminal again, type crontab -e to edit the crontab, delete the line you entered with this tip (you can press ‘dd’ to delete the current line, for example), then save and quit (‘zz’).
Thanks! It still works flawlessly!
I get the following error when I try to run the script: /Users/marn/Library/Scripts/sync-status-with-twitter.rb:39: undefined method `text' for nil:NilClass (NoMethodError) Any ideas?
There's no error checking in the script (mostly because I'm a bit lazy sometimes), so unfortunately it doesn't give very helpful feedback if there's a problem – that error suggests to me that either it has an invalid twitter name, or a network problem – In this case, it's trying to get 'text' (the content) from an element in the Twitter timeline RSS, but it couldn't find that element (which is why it's "nil:NilClass"). Make sure you're using the right twitter name and that your network connection's solid.
Script works wonderfully except for a stray “” on the end of each tweet.
I.E. “just got home from school.”
Any idea on how to correct this? Using Adium 1.4b9, OSX 10.6.1.
Sorry, I meant /content, except with brackets around it. Doesn’t display correctly in this comment system.
I.E. “just got home from school./content”
Nevermind, fixed it myself by parsing it out. Nothing like a crash course in Ruby!
Hi Kegan,
I’ve the same problem. Can you post your fix please? :) Thanks!
Okay, so you’re going to insert this line of code:
message = message[0,message.length-10]
after this line in the program:
exit if ! message
It’s a pretty remedial fix, given that I don’t know Ruby. I’m sure there’s a more sensible fix.
Thanks a lot, Kegan! :)