iChat Script - Display Dialog

Hey guys,

I’m new to this whole AppleScript and programming stuff, however, I am currently writing my first script. I am trying to put together a script that will display a dialog when certain people sign on to iChat therefore, I have the following so far:

tell application “iChat”
set buddyNames to textbody
if textbody = “i would put my friends screennames here” then
display dialog “They are now online!”
end if
end tell

It is telling me that i must define “textbody”, however, I have no clue how to define that – i’m thinking the textbody is the listbox but would i put under “set buddyNames to textbody” the following:

set textbody to listbox

am I on the wrong track?

Model: iBook G4
AppleScript: 2.1
Browser: Safari 412.5
Operating System: Mac OS X (10.4)

First, please note that this is the forum for OS 9 and earlier. Second, iChat can speak the names of users as they become available (it’s in prefs), but since you asked for a script, and you only want to hear about particular buddies, I wrote this script:

property was_online : {}
property watch_list : {}

set was_online to check_ichat()
set watch_list to {"special buddy", "important buddy"}

on idle
	set is_online to check_ichat()
	repeat with x in is_online
		copy contents of x to y
		ignoring case, expansion and white space
			if y is not in was_online and y is in watch_list then say y & " is online."
		end ignoring
	end repeat
	set was_online to is_online
	return 10
end idle

to check_ichat()
	tell application "iChat" to name of accounts of service 1 whose status is not offline
end check_ichat

For this to work you must save the script using the “Application” file format having checked the “Stay Open” option. Then you can launch the script with Finder and so long as it’s left open it will check the status of your buddy list every ten seconds.

edit: to change that so that it displays a dialog box, replace the word “say” with “display dialog”
Also note that you should probably replace “special buddy” etc. with the usernames of actual buddies.

I really appreciate it. And, I’m sorry to have posted this in the wrong forum. Thanks. :slight_smile: