iChat, Growl, and Lion
UPDATE: This script has been improved; the new version is now on github.
UPDATE 2: Growl 1.3 was just released, so I've updated the script to work with 1.3. If you were using this script and it broke with 1.3, then just download the updated version from the same place. If you're still using Growl 1.2.2, you'll need to use the old version of this script. All the rest of the instructions are the same regardless of which version of Growl you're using.
Lion is the latest version of OS X. iChat is the chat program that's part of OS X. Growl is a system that lets all sorts of programs post little notification windows on your screen.
For example, if you get a message in iChat while you're in another window, it's nice to have the message pop up on your screen so you can decide whether or not to switch windows to read it. Or if a buddy logs in, it's nice to know about that (which can be done in iChat with an audio notification), and see who it is without having to check your buddy list.
I used to use Chax for this. Chax is a pretty good program, but when a new version of OS X comes out, it takes a little while to catch up. The main reasons I use Chax are:
UPDATE 2: Growl 1.3 was just released, so I've updated the script to work with 1.3. If you were using this script and it broke with 1.3, then just download the updated version from the same place. If you're still using Growl 1.2.2, you'll need to use the old version of this script. All the rest of the instructions are the same regardless of which version of Growl you're using.
Lion is the latest version of OS X. iChat is the chat program that's part of OS X. Growl is a system that lets all sorts of programs post little notification windows on your screen.
For example, if you get a message in iChat while you're in another window, it's nice to have the message pop up on your screen so you can decide whether or not to switch windows to read it. Or if a buddy logs in, it's nice to know about that (which can be done in iChat with an audio notification), and see who it is without having to check your buddy list.
I used to use Chax for this. Chax is a pretty good program, but when a new version of OS X comes out, it takes a little while to catch up. The main reasons I use Chax are:
- Accept text chat invitations without being prompted.
- Put all my buddies in the same window.
- Give me Growl notifications.
Everything but the Growl feature is now built into iChat in Lion. (The auto-accept is an AppleScript that ships with Lion; you can turn that on in Preferences:Alerts. The option for "Show all my accounts in one list" is in Preferences:General.)
Chax isn't yet compatible with Lion, so I searched online and found a little AppleScript program to do a bit of what I need. Using the ideas from that, I expanded it a bit. Goodbye Chax; I'll miss you!
To use this:
To use this:
- Install Growl, if you don't have it already.
- Visit https://github.com/Piquan/iChat-Growl/raw/master/Growl.applescript in your web browser. (You can use the formatted page instead.)
- Open AppleScript Editor (in Applications:Utilities).
- Copy and paste the code from the web page into a new script.
- Save it to your home directory's Library:Scripts:iChat folder. (I used the filename "Growl".) The iChat folder might not exist; you need to create it. By default, your Library folder is hidden. (Personally, I solved that by saving to the desktop, and then I ran "open ~/Library/Scripts" in Terminal so that the Scripts window opened in Finder, and dragged my script there.)
- In iChat, open the Preferences.
- Under Alerts, select the "Message Received" event.
- Turn on "Run an AppleScript script:", and select the script you saved earlier.
- Repeat the last two steps for each event you're interested in.
Note that the "Message Received in Chat Room" (which is called "addressed message received" in the AppleScript) and "Invitation to Share Buddy's Screen" (a.k.a. "received remote screen sharing invitation") aren't currently enabled, since it looks like there may be a bug in iChat that will cause them to be confused with each other.
If you use the Growl script for chat invitations, you can't also use the Auto-Accept script, since you can only select one script to be run. Because of this, I've added an auto-accept capability to this Growl script. By default, it's turned off, but you can turn it on. Near the top of the program, there's a line that says:
Change this to:
If you use the Growl script for chat invitations, you can't also use the Auto-Accept script, since you can only select one script to be run. Because of this, I've added an auto-accept capability to this Growl script. By default, it's turned off, but you can turn it on. Near the top of the program, there's a line that says:
property autoAccept : {""}
Change this to:
property autoAccept : {"text"}
Suggestions for improvements are welcome. Share and enjoy!
(If you expected the source code to be here in my blog, I've moved it. See https://github.com/Piquan/iChat-Growl/raw/master/Growl.applescript for my latest version.)
(If you expected the source code to be here in my blog, I've moved it. See https://github.com/Piquan/iChat-Growl/raw/master/Growl.applescript for my latest version.)
Comments
Thanks!
"An error occurred while executing an AppleScript event handler.
Event: Message Received
File: ichat-growl.scpt
Error: GrowlHelperApp got an error: Connection is invalid
"
I'm using ichat with jabber connection to google. Not sure what to do to fix this.
Thank you :)
PS: The Script is great!
Expected end of line, etc. but found """.
The quotation mark selected by AppleScript Editor is the first one in the line beginning:
register as application "
If Growl 1.3 is installed, then please file an issue at https://github.com/Piquan/iChat-Growl/issues and we can work through this problem there. If you have Growl 1.2.2, then change the line tell application "Growl" to tell application "GrowlHelperApp" (as described in the comment just above that line). If you don't have Growl installed, then you need to install it before you can use this script.
Also, auto-accept isn't working for me either, whereas the Apple-included script works fine. I'll have more of a play later tonight and see if I can find the problem.
I also worked out my problem with auto-accept. I misread your instructions and installed the script into ~/Library/Scripts/Applications/iChat/ (where you place scripts that are accessible from the AppleScript menubar icon). I turned out that when I selected this script via the file browser in iChat, it created a copy in ~/Library/Scripts/iChat/ . Hence the problem was that iChat was reading the old version of the script.
Cheers again!
-- Don't do anything if we're chatting with the buddy in question
try
local frontApp, windowName
-- This is in a "try" because, if things aren't exactly as we're expecting (e.g., iChat is frontmost but has no windows open), we want to go ahead and growl.
tell application "System Events" to set frontApp to name of first application process whose frontmost is true
if frontApp is "iChat" then
tell application "iChat" to set windowName to name of front window
-- Character id 8212 is an em dash. We don't use a literal, because AppleScript uses Mac-Roman or UTF-16 (with a BOM), but github will show it as ISO-8859-1. To allow both clones and web browsing to work, we use ASCII only.
if windowName starts with (buddyName & space & character id 8212 & space) then return
if windowName ends with (space & character id 8212 & space & buddyName) then return
end if
end try
If that doesn't fix your problem, then let's finish this conversation at github instead. Go to https://github.com/Piquan/iChat-Growl/issues/new and file an issue. (You'll need a github account, but it's a quick signup, and the free account will be fine.)
Works great in Growl 1.2/OS X 10.7.2
Thanks !
http://tiagodovale.deviantart.com/art/Chax-alternative-for-iChat-Growl-and-Auto-Resize-284084652
Just a quick note, when I use the script to notify me of account log offs, and I log off of one of my two accounts (Jabber+AIM), then the Growl logoff notification appears twice. Completely minor, but just thought I'd point it out.
Using Growl 1.2.2 on OSX 10.7.3
now i can delete Adium :-)
Growl with iChat, love it!!!
http://tiagodovale.deviantart.com/art/Growl-AutoResize-for-MESSAGES-Beta-285399682