Re: iChat, Leopard and determining if a buddy has a chat
Re: iChat, Leopard and determining if a buddy has a chat
- Subject: Re: iChat, Leopard and determining if a buddy has a chat
- From: "J. Stewart" <email@hidden>
- Date: Mon, 12 Nov 2007 07:53:47 -0500
On 11/11/07 at 9:19 PM, Richard Brosnahan <email@hidden> spake thusly:
I've got a script that almost works.
Using iChat in Leopard, I want to sent a message to a buddy periodically. A
chat with that buddy might already exist, and it might not.
If I execute the script and a chat doesn't exits already, it creates a chat
and sends the message. That's good.
If I execute the script and the chat already exists, iChat complains, saying
a chat with that buddy already exists and that I should use that existing
chat. I'd love to.
I created a subroutine to determine that, but Applescript returns an error
that I consider pretty stupid, or at least cryptic.
I loop thru every chat to find the list of participants in each, and then
thru the participants to find the buddy.
The error is
"can't make buddy id of theParticipant into a type specifier"
I tried comparing handles but AppleScript says it can't make the handle into
text.
So I can't compare values and can't convert the values to strings and
compare them.
Frustrating.
<snip>
First off, I use Adium not iChat, I've also not scripted iChat
for a long time so I can't test my suspicions but this line of
your script may be the culprit:
if id of theBuddy is buddy id of theParticipant then
Try replacing it with something like -
if id of theBuddy is id of (contents of theParticipant) then
Notes:
I dropped "buddy" from the right side of the comparison. iChat's
dictionary doesn't show a "buddy id" property for the "buddy"
class. Your usage of it might be correct but I'd try variations
of it just to test.
You are "looping by reference" and there are circumstances where
the reference doesn't resolve to what you expect. If the
reference doesn't resolve then you are trying to get the id of
the reference not the target of the reference. "Contents of"
forces it to resolve to the target of the reference.
--
The views expressed here do not necessarilly represent the
unanimous view of all parts of my mind.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden