Automate iChat invitation

Hi all

I am a newb to Apple Script and I am currently working on a project which requires two computers to be in an iChat audio conversation for a set amount of time.

I have two mac minis both running Leopard.

I have set one to AutoAccept an incoming audio invitation via the iChat prefs pane. This works very well.

At this point I am trying to get the other Mac mini to:

Log into iChat
Select the buddy in the buddy list
Send an audio invitation

I can see from the AppleScript Library for iChat that this would be a possibility but I don’t know how to write the code. I could set up the CRON tab on both machines to start and stop the scripts as necessary.

I set up a keyboard shortcut to automatically send an audio invitation, perhaps it might be as simple as triggering this keystroke in an AppleScript. Is there a simple method for doing this?

The reason I am doing this is for an art project which allows two spaces to be aurally connected.

Any help/advice would be much appreciated
Best wishes
J

Model: Mac mini - Leopard
AppleScript: 2.2
Browser: Safari 525.13
Operating System: Mac OS X (10.5)

Further to my comments earlier I have come up with this. But AppleScript thinks the ‘i’ is an undefined variable.


tell application "iChat"
	activate
	tell application "System Events"
		tell process "iChat" to set frontmost to true
		tell application "System Events"
			keystroke using control down & command down & option down & i
		end tell
	end tell
end tell

Also I did try and use the System Events to choose the particular menu item in iChat.

I figured it would be item 11 of menu “Buddies” but it wouldn’t trigger the invite. Here is what the script looked like.


tell application "iChat"
	activate
	tell application "System Events"
		tell process "iChat" to set frontmost to true
		tell process "iChat" to click menu item 11 of menu "Buddies" of menu bar 1
	end tell
end tell

I realised that the buddy in the list needed to selected but at least this was a step in the right direction. I found the script here in the forums while researching my problem.

Also in the library for applescript there does not seem to be examples of how to use a particular…or have I just not looked properly?

Eg. Below is the library information for the received audio invitation
received audio invitation‚ve : This handler is called for incoming audio invitations.
received audio invitation
from buddy
for audio chat

well again I would be very appreciative of any advice that you may have
best
j

Hi,

GUI scripting isn’t necessary at all!
To invite a buddy to an audio chat this is sufficient.


tell application "iChat" to send audio invitation to buddy "myBuddy"

To trigger a script with a keyboard shortcut, you need tools like FastScripts, QuicKeys, Butler, QuickSilver

hi stefan

thanks so much for the tip, i tried this and it worked!!!

fabulous and thanks so much

do you think there is a simple way to check if it is running?

that was the next part of my problem

thanks again
:slight_smile:
jamil

i was thinking of doing this part with an unix exe that probed the process TOP but i’m not too sure…anyway at worst i can kill the app and then restart it all over re-establish connection etc

it just means that you would hear an audio break every 10mins or whenever I set it to restart

Try something like this, save it as application with option stay open.
It checks every 10 minutes if the chat is connected and sends the invitation again


on idle
	tell application "iChat"
		set b to buddy "myBuddy"
		if active av chat is missing value then
			try
				tell window ("Audio Chat with " & full name of b) to close
			end try
			send audio invitation to b
		end if
	end tell
	return 10 * minutes
end idle

Hi Stefan

That is just brilliant, I mentioned earlier that it would be nice if apple gave usage examples of the terms within the library…so that a novice like me could fumble their way through it. Perhaps this exists and I wasn’t able to locate it.

Anyway thanks again, I am just about to start trialing it, I’ll let you know how it goes

Best
Jamil

This is almost exactly what I’m looking for, but how do you make it send a screen sharing invitation?

Not at all, unfortunately the dictionary of iCal doesn’t contain any screen sharing invitation command