使用 applescript 更改 iChat 设置?

发布于 2024-11-14 16:26:24 字数 291 浏览 1 评论 0原文

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

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

我想要一个执行此操作的脚本:

激活 iChat 打开 iChat 偏好设置 移至“警报”选项卡 选择事件“已收到消息” 打开“运行 applescript” 从名为“Message Receive.applescript”的脚本文件夹中选择某个脚本

请帮忙?

Is there a way to create a script that will change the preferences of iChat to run the script when a message is received?

In other words, I want to make a script to change the iChat preferences to enable the "Message Received.applescript" i have created. Wow, this is confusing. Let me simply this.

I want a script that does this:

Activate iChat
Open iChat Preferences
Move to "Alerts" tab
select event "Message Received"
turn on "Run applescript"
select a certain script from the script folder called "Message Receive.applescript"

please help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泛泛之交 2024-11-21 16:26:24

您只需要编辑 iChat 的 plist 文件即可。 defaults 对于嵌套值来说有点尴尬,因此请使用系统事件:

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 才能使更改生效。

You just need to edit iChat's plist file. defaults is a bit awkward for nested values so use System Events instead:

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

This will attach "Message Received.scpt" to both initial text invitations and subsequent messages - you could simplify it if you only wanted it for subsequent messages. Also note you may need to relaunch iChat for the change to take effect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文