使用 Applescript 创建智能邮箱?

发布于 2024-08-19 06:13:57 字数 491 浏览 5 评论 0原文

我正在尝试使用基于当前所选消息的标准在 Apple Mail 中自动创建智能邮箱(例如,创建一个文件夹来显示发送当前消息的人的所有消息)。显然,我可以手动创建一个智能邮箱,但因为我经常这样做,所以我希望将其自动化。

我在邮件词典中找不到任何有关智能邮箱的参考。我进行了互联网搜索,但找不到任何用于在 Applescript 中操作智能邮箱的示例代码,只有 2006 年的讨论中的参考资料表明(线程底部)这是无法完成的: http://forums.macosxhints.com/archive/index.php/t-51935.html

我还找到了一个脚本来打开创建智能邮箱对话框,但这不是我想要的。

有人知道是否有办法在 AppleScript 中创建/编辑智能邮箱?

谢谢。

I am trying to automate the creation of a smart mailbox in Apple Mail using criteria based on the currently selected message (e.g. create a folder to display all messages from the person who sent the current message). Clearly, I can go in and create a smart mailbox by hand, but because I do this regularly I am hoping to automate it.

I could not find any reference to Smart Mailboxes in the Dictionary for Mail. I did an internet search and could not find any sample code for manipulating Smart Mailboxes in Applescript, only a reference in a discussion from 2006 that says (bottom of the thread) that it can't be done: http://forums.macosxhints.com/archive/index.php/t-51935.html

I also found a script to bring up the create smart mailbox dialog, but that's not what I'm looking for.

Anyone know if there's a way to create/edit a smart mailbox in AppleScript?

Thanks.

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

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

发布评论

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

评论(1

情丝乱 2024-08-26 06:13:57

您必须使用 GUI 脚本。我使用 Python + appscript 完成大部分脚本编写,但这里有一个用于创建智能邮箱的快速 Applescript 片段。我应该指出,没有正式的 Applescript 支持来处理智能邮箱是可笑的。

tell application "Mail"
    activate
end tell

告诉应用程序“系统事件” 告诉进程“邮件” 告诉菜单栏1 告诉菜单栏项目“邮箱” 告诉菜单“邮箱” 单击菜单项“新建智能邮箱...” 结束告诉 结束告诉 结束告诉

delay 1 keystroke "t" using shift down keystroke "e" keystroke "s" keystroke "t" keystroke tab keystroke "m" keystroke "o" keystroke "r" keystroke "e" end tell

结束告诉

You have to use GUI scripting. I do most of my scripting using Python + appscript but here's a quick Applescript fragment to create a Smart Mailbox. I should note that not having formal Applescript support for handling smart mailbox is ludicrous.

tell application "Mail"
    activate
end tell

tell application "System Events" tell process "Mail" tell menu bar 1 tell menu bar item "Mailbox" tell menu "Mailbox" click menu item "New Smart Mailbox…" end tell end tell end tell

delay 1 keystroke "t" using shift down keystroke "e" keystroke "s" keystroke "t" keystroke tab keystroke "m" keystroke "o" keystroke "r" keystroke "e" end tell

end tell

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