我将在此之前提到我是Apple的新手...
我有iChat设置为每当收到新邮件时运行此脚本:
using terms from application "iChat"
on message received theMessage from theBuddy for theChat
set theHandle to handle of theBuddy
tell application "MyApp"
receivedInstantMessage from theHandle message theMessage
end tell
end message received
end using terms from
这可以正常工作MyApp(我正在编码)接收两个字符串(伙伴的句柄和消息内容)。唯一的麻烦是这个脚本似乎只在iChat中收到至少一条消息后才能工作。即,脚本似乎只能从第二个消息开始工作。如果好友退出,他必须在我的应用收到AppleEvent之前再次发送两条消息。
我在这里犯了一个基本错误吗?
答案 0 :(得分:0)
第一条消息实际上是“文本邀请”,因此您的通知脚本需要另一个处理程序:
on received text invitation theMessage from theBuddy for theChat
-- your tell app statement goes here
end received text invitation