我将以我是applescript新手这一事实作为开场白。
我将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之前,他将不得不再次发送两条消息。
我是不是犯了一个基本的错误?
发布于 2011-02-01 20:08:44
第一条消息实际上是“文本邀请”,因此您的通知脚本将需要另一个处理程序:
on received text invitation theMessage from theBuddy for theChat
-- your tell app statement goes here
end received text invitationhttps://stackoverflow.com/questions/4861140
复制相似问题