首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过Applescript获取iChat消息的内容

通过Applescript获取iChat消息的内容
EN

Stack Overflow用户
提问于 2011-02-01 17:59:05
回答 1查看 2.4K关注 0票数 1

我将以我是applescript新手这一事实作为开场白。

我将iChat设置为在收到新消息时运行此脚本:

代码语言:javascript
复制
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之前,他将不得不再次发送两条消息。

我是不是犯了一个基本的错误?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-02-01 20:08:44

第一条消息实际上是“文本邀请”,因此您的通知脚本将需要另一个处理程序:

代码语言:javascript
复制
on received text invitation theMessage from theBuddy for theChat
  --  your tell app statement goes here
end received text invitation
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4861140

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档