myNotifications is the key
I'm an applescript noob, could you explain how i could edit the message it sends to Growl so that it is one line that says, Buddy Name + "went offline." (for when the buddy logs off) and, Buddy Name + "came online." (for when the buddy logs on)
The short answer is to edit the "myNotifications" record.
With a little bit of work, you can learn how to figure this out yourself. The quickest way is to look within the script for the text of one of the growl messages. Say your friend Fred comes online and you get the Growl notification "Fred Derf is available." The name "Fred Derf" will change from notification to notification, but "is available" should be the same every time a buddy comes online. Looking for "is available", we find it in myNotifications.
If the quick method doesn't work for a particular script (for instance, there's not enough text that remains constant from notification to notification), there's a slightly more involved way: trace handler calls. Growl notifications are posted by sending a "notify" message to
Growl. Even if you didn't know this, the "growl(..)" handler in this script seems a likely place to start. Indeed, the "growl(...)" handler sends a "notify" message to "GrowlHelperApp".
Code:
on growl(notif, descr, img)
tell application "GrowlHelperApp"
try
notify with name notif ¬
title notif ¬
description descr ¬
application name myAppName ¬
image img
Examining the code, the message is passed in the 2nd argument ("descr") to "growl(notif, descr, img)". "growl(...)" is called in the script's own "notify" handler.
Code:
on notify of notif by bud
set uName to full name of bud
set msg to uName & (action of notif)
set img to a reference to image of bud
growl(title of notif, msg, image of bud)
end notify
Here we see the value for "descr" comes from "msg" and is "uName & (action of notif)". "uName" comes from the buddy information ("full name of bud") and is provided by iChat; "notif" is an argument to "notify", and its action property provides the message text. In other words, the Growl message is the buddy's full name prepended to a string that depends on what the buddy has done (the "buddy event"). To change the message, we need to find where that string comes from. Now we examine a call to "notify", such as when a buddy comes online.
Code:
on buddy became available bud
notify of (budAvail of myNotifications) by bud
end buddy became available
Here we see that "notif" is item "budAvail" of "myNotifications". Now we have our answer: to change the message, find the item of "myNotifications" that corresponds to the buddy event, and change the value for its "action" property.
Once you absorb this, you can figure out what needs to be changed in other's scripts on your own.
To learn a little more about AppleScript, read MacWorld's "
Using Tiger: Learning AppleScript" article. If you really want to learn how to use AppleScript, read
Apple's documentation