Apple
March 28, 2008
At dealnews, we have an internal Jabber server that we use for our internal communications. As part of that, we have a number of internal chat rooms for the various areas of the company.
I’m a big believer in automation - that is, scripting various repetitive actions that I have to do every so often. One of these little things is joining our developer chat channel each morning when I get to the office. Unfortunately, there’s no built in way in Adium to do this, nor does Adium expose native AppleScript commands to join group chat. It does for other functions, but group chat functionality is conspiciously absent, even though there’s a long standing feature request to implement this.
So, we have to hack it. In this case, I used AppleScript to imitate keyboard input
set CR to ASCII character of 13
tell application "System Events"
tell application "Adium" to activate
keystroke "j" using {command down, shift down}
keystroke "development"
keystroke CR
end tell
So we have a script, but how to automate the launching of it?
I mentioned MarcoPolo before. It has quickly become one of my favorite pieces of Mac software. In this case, I use MarcoPolo to launch the AppleScript (with a 10 second delay to allow time for Adium to start and connect to the Jabber service). You can launch AppleScripts using the osastart utility like so:
/usr/bin/osastart /Users/codelemur/Scripts/DevChat_AutoJoin.scpt
It sucks that it’s like this, and I wish they would expose a more native way to do this, but it does work.
Read More