Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ilostmywaytobed

macrumors newbie
Original poster
Feb 25, 2010
2
0
hey everyone,

I just started learning applescript yesterday, so bear with me.

I wanted to write a script for iChat which opens an IM window every time a specific buddy signs on.

Here is my script:

tell application "iChat"
if (buddy became available "hetu1989") then
show chat chooser for "hetu1989"
end if
end tell

When my screen name "hetu1989" signs on, my iChat gives me the following error:

am5qht.jpg


I tried to find out how to get rid of this error, and I saw that some pople had also encountered it, but those threads didn't help me much. So, any help will be appreciated.
Thanks a lot!
 
I don't use iChat, so i'm probably terribly misled ...

Just a shoot from the hip, but as "buddy became available" is an Event, try to catch that with

Code:
tell application "iChat"
  activate
  on buddy became available "hetu1989"
    show chat chooser for "hetu1989" 
  end buddy became availabe
end tell

The -1708 error shows that an Event wasn't handled by an Event Handler. For the "buddy became available" is the only Event in your script, this could be the trap ...
And as for the "chat chooser" being a dialog, it could help to activate the iChat App before.
 
ahh, i figured it out.

Code:
set hetu1989 to buddy(AIM, hetu1989)

using terms from application "iChat"
	on buddy became available hetu1989
		show chat chooser for hetu1989
	end buddy became available
end using terms from


using terms from application "iChat"
	on buddy became unavailable
		close (show chat chooser hetu1989)
	end buddy became unavailable
end using terms from

By the way, is there anyway to make it accept the chat chooser automatically?

thanks for the help everyone.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.