iChat video invite


I really wanted to figure this out on my own, but the AppleScript dictionary on iChat is not helpful.

I want to do the following – set in iChat Alert preference to run the script upon receiving new text invitation or new message.

Upon receiving a new message (or text invitation – I’m assuming that when someone sends you a new message in a new window, that is considered as a text invitation), I want my iChat to:

  1. Set status to invisible.
  2. Check if they have video capability
  3. Invite that same buddy to video chat (I don’t want to specify a specific buddy name – just the SAME buddy that sent me message)

That’s it.

What I have so far:

tell application “iChat”
set status to invisible
set theStatus to get capabilities of buddy “buddyname”
if theStatus contains video chat then
send video invitation to buddy “buddyname”
end if
end tell


Model: MacBook
Browser: Safari 528.16
Operating System: Mac OS X (10.5)

the dictionary is very helpful, if you know how to read it :wink:
try this, put the script into ~/Library/Scripts/iChat and connect it to the Received Message event

using terms from application "iChat"
	on message received themessage from theBuddy for theChat
		set theStatus to capabilities of theBuddy
		if (theStatus contains video chat) then
			set status to invisible
			send video invitation to theBuddy
		end if
	end message received
end using terms from

The script generated an AppleScript Event Handler Error -1708.

the above error was from your script. What am I doing wrong here?

Hm… I was able to re-use Apple’s AutoAccept script for iChat to accept and display incoming messages and reply with a text string, but the status change to invisible or video invitation never worked.

Really appreciate your help!

I admit, that I tested the script only with audio invitation instead of video chat,
because I don’t have two computers with a camera. It works with audio invitation

When I look in iChat AppleScript Dictionary, it says invite text or audio only. No video invite, apparently. I’m hoping it’s wrong.

Can I use your example from this link?


Problem is – that script begins with “tell iChat”, instead of “using terms from iChat” – is there a difference?


of course you can use the script.
In an application event handler you can omit the application tell block

Here’s what I have so far – still no dice. It works on accepting theChat, and sends message of “Yo! Video invite coming at you!”. But it does not change the status to invisible or make new video chat.

theBuddy is already of class buddy, so omit buddy

You could check if the target buddy really supports video chat by displaying or logging its capabilities

Error: Can’t make theBuddy of «class icsv» 2 into type reference.

(I did – followed your advice, and got the above error. Here’s the script as it stands – status change now works.) But the video invite still does not work. Got the error above.

Stefan – you’ve been TREMENDOUSLY helpful, thank you! I just wish I can get my head wrapped around the scripting basics – still don’t understand the difference between tell “iChat” vs using terms from application “iChat”, so forth…

where does of service 2 come from ?

I added “of service 2” after I got error code complaining Service was not specified for the video chat invite. Service 1 is bonjour. Service 2 is my AIM.



I still am unable to get video invite to work with theBuddy – any suggestions?


sorry, as mentioned above I can’t test anything because of the lack of 2 cameras.

tell service 2 to make.

I wanted to reply and say it WORKED! Here’s the script:

Now, the video invite script is broken in Snow Leopard… Stefan, anyone – any ideas how to fix this?

I keep getting this error" The variable screenname is not defined." -2753

What I have now that used to work now does not… and this is a subset of larger script:

theBuddy references to a previous script line. This works flawlessly in Leopard. Not so much in Snow Leopard.