What's Happening

pudge on 2003-06-25T05:45:39

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);


scripting documentation

drhyde on 2003-06-25T08:20:21

I've been following your Mac scripting stuff for some time, and it all looks dead useful. Trouble is, to use it effectively I need to also know what the events and properties supported by all the various apps are - and I can't find any good documentation anywhere. Could you enlighten us as to where you've found it?

Re:scripting documentation

Fletch on 2003-06-25T13:39:47

Just fire up the AppleScript ScriptEditor app and use File -> Open Dictionary to get all the info. Of course a glue-to-(pod|rtf|html) convertor might be an interesting alternative . . .

Oh, and Pudge++ for Mac::Glue.

Re:scripting documentation

pudge on 2003-06-25T14:29:28

gluedoc iChat
gluedoc accepts several of the flags perldoc does.

Re:scripting documentation

drhyde on 2003-06-25T14:55:39

Ooh! Shiny!