首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用applescript更改iChat设置?

使用applescript更改iChat设置?
EN

Stack Overflow用户
提问于 2011-06-10 11:30:29
回答 1查看 626关注 0票数 2

有没有办法创建一个脚本来更改iChat的首选项,以便在收到消息时运行该脚本?

换句话说,我想创建一个脚本来更改消息首选项,以启用我创建的“iChat Received.applescript”。哇,这太让人困惑了。让我简单地说一下。

我想要一个这样的脚本:

激活iChat打开iChat首选项移动到“警报”选项卡选择事件“收到的消息”打开“运行应用程序脚本”从名为"Message Receive.applescript“的脚本文件夹中选择某个脚本

请帮帮忙?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-06-17 15:54:10

你只需要编辑iChat的plist文件。defaults对于嵌套值来说有点笨拙,所以请改用系统事件:

代码语言:javascript
运行
复制
tell application "System Events"
    set EventActions to property list item "EventActions" of property list file ((path to preferences folder from user domain as text) & "com.apple.iChat.plist")
    repeat with e in {property list item "MessageNotification" of EventActions, property list item "SubsequentMessage" of EventActions}
        make new property list item at end of e with properties {name:"RunAppleScript", value:true}
        make new property list item at end of e with properties {name:"iChatAppleScriptsKey", value:{"~/Library/Scripts/iChat/Message Received.scpt"}}
    end repeat
end tell

这会将"Message Received.scpt“附加到初始文本邀请和后续消息-如果您只想在后续消息中使用它,您可以简化它。另请注意,您可能需要重新启动iChat才能使更改生效。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6301688

复制
相关文章

相似问题

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