Re: script iChat to send message
Re: script iChat to send message
- Subject: Re: script iChat to send message
- From: Phi Sanders <email@hidden>
- Date: Tue, 18 Nov 2003 21:01:07 -0500
OK - so I can get iChat to send a message with this syntax :
tell application "iChat"
set vMessage to "testing 1 2 3"
send vMessage to account 13
-- 13 is just an integer
-- numerical reference is the only form I have gotten to work...
end tell
This sends to whomever the 13th account is, which is apparently
determined by some arcane ordering I do not understand. I am able to
find a match and send a message in this manner :
===============================================
set vOKtoSend to false
set vTarget to "aim_handle" as Unicode text
tell application "iChat"
set vAccountList to every account
repeat with i from 1 to number of items in vAccountList
set vCandidate to (handler of account i) as Unicode text
if vCandidate is equal to vTarget then
set vAccountNum to i
set vOKtoSend to true
display dialog vCandidate & return & "Account # : " & i
exit repeat
end if
end repeat
end tell
if (vOKtoSend) then
set vMessage to "testing iChat applescript"
tell application "iChat"
send vMessage to account vAccountNum
end tell
end if
===============================================
But that is such a pain in the tush! Not to mention ugly... There has
to be a better way. Anyone got some pointers for me? (Is Jens still on
the iChat team?)
Also, I want to have the capability to send to an arbitrary "handler"
(note: says "handle" in the dictionary) like you can with the "new chat
with person" menu item. GUI scripting is an area I haven't gotten into
yet, and I'm so close now that I'm loathe to resort to menu puppetry
~Phi
On Nov 16, 2003, at 7:01 PM, Phi Sanders wrote:
I want to automate sending a message via iChat AV under Panther (to
send intermapper alerts to my treo) and am having trouble figuring out
the "send" command syntax :
send: Send account a text message or video invitation.
send reference -- the object for the command
[to account]
The "reference" part is what has me stymied, as I believe "to account"
would accept "to 'email@hidden'" - I've tried all kinds of random
variations, but I ether get...
Error "send command not sent to an account object" when I try :
set vMessage to "this is a test IM from my script"
set vChatter to "aim_handle"
tell application "iChat"
send vMessage to vChatter
end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.