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.rbThe ‘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: 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.