What's Happening

| | Comments (0)
So I've put together a script to update my iChat status, and it has evolved over time. It used to work with iChatStatus, but now iChat AV is scriptable, so I can update the status message from Mac::Glue.

The script I use now is called happening, and it forks itself into the background (startup of Mac::Carbon stuff is still pretty slow and processor-intensive in dyld, so it stays running all the time ... besides, I set it to run every 15 seconds anyway), and then runs through a series of checks on each loop.

It first looks to see if I am watching EyeTV locally, then looks to see if I am listening to an MP3 in iTunes. Then it calls another machine, executing a similar script, to see if that machine is running EyeTV or iTunes (right now this is done via ssh, but I am going to rewrite that remote script to also be a daemon, and have it write out a file I can check via HTTP; much more efficient).

If all those fail, it shows the current app, and if somehow that fails, it puts up something from fortune(6).

It makes heavy use of Mac::Glue to talk to iChat, iTunes, EyeTV, and System Events. It's super sweet! Note how it caches objects it is going to reuse ... makes it super fast and efficient, too. There are a bunch of me-specific things hardcoded in it ... sorry if that gets in your way. :-)
Here are the key lines for talking to iChat:

$status  = $ichat->prop('status');
return unless $status->get eq 'available';
 
$message = $ichat->prop('status message');
$message->set(to => $output);

use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on June 24, 2003 10:45 PM.

Mac-OSA-Simple-1.05 Released was the previous entry in this site.

Mac-OSA-Simple-1.06 Released is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.