One of the nicer features in the OS X 10.5 version of iChat is its ability to run AppleScripts based on certain events occurring. If you’re an AppleScript wizard, you can use this feature to make iChat do all sorts of interesting things–I’ve previously covered using three Apple-bundled AppleScripts to automatically accept (or decline) chat requests and to control iTunes.
Today, I’ll show you how to use four additional AppleScripts that automatically set your iChat status message when you’re in an audio or video chat. These scripts are courtesy of macosxhints.com reader Micahel Potvin; I’ve chosen to use them here because they’re fairly simple and yet demonstrate some of what you can do with iChat’s AppleScript support. They can also be easily customized to your liking by changing the provided status message lines.
The first thing you need to do is create the following four AppleScripts. Open Script Editor, in Applications -> Utilities, and copy and paste the following code snippets, saving each one to your user’s Library -> Scripts -> iChat folder. (Create this folder if necessary.) In Script Editor’s Save dialog, leave the File Format pop-up set to Script, and you can ignore the other options shown there. Name each file as you wish; I’ve suggested some file names in the first (commented) line of each piece of code.
— filename: join_videochat using terms from application “iChat” on received video invitation theText from theBuddy for theChat set status to away set status message to “In conference” end received video invitation end using terms from
— filename: join_audiochat using terms from application “iChat” on received audio invitation theText from theBuddy for theChat set status to away set status message to “In conference” end received audio invitation end using terms from
— filename: avchat_started using terms from application “iChat” on av chat started set status to away set status message to “In Conference . . .” end av chat started end using terms from
— filename: avchat_ended using terms from application “iChat” on av chat ended set status to available set status message to “Available . . .” end av chat ended end using terms from
Once you’ve created all four scripts, switch to iChat, open its preferences, and click on the Alerts tab. You need to tell iChat to run your new scripts based on four unique events occurring. Set the Event pop-up as specified below, check the Run AppleScript box, and then click the pop-up menu next to the Run AppleScript box. In the pop-up menu, you’ll see the four scripts you just created, along with the three provided by Apple. Associate each script with an Event, like this:
Event: Audio Invitation | Run AppleScript join_audiochat.scpt
Event: Video Invitation | Run AppleScript join_videochat.scpt
Event: A/V Chat Started | Run AppleScript avchat_started.scpt
Event: A/V Chat Ended | Run AppleScript avchat_ended.scpt
From now on, whenever you join an audio or video chat, your status will be set to Away, and your status message will be changed to In conference, or whatever text you choose to use in the scripts. When you exit the chat, your status (and your status message) will revert to Available.