使用 JavaScript 实现自动化而不是 AppleScript 的邮件规则 [英] Mail Rules using JavaScript for Automation instead of AppleScript
本文介绍了使用 JavaScript 实现自动化而不是 AppleScript 的邮件规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用自动化的 Javascript 而不是 AppleScript 来构建 Mail.app 规则(在 OS X Yosemite 上),但我停留在基础知识上.
I'm trying to build a Mail.app rule (on OS X Yosemite) using Javascript for Automation instead of AppleScript, but I'm stuck on the basics.
我在 AppleScript 中看到了这段代码:
I see this code in AppleScript:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
# actual code here
end perform mail action with messages
end using terms from
但我不清楚这如何转换为 JavaScript.
but I'm unclear how this translates to JavaScript.
我是否定义了一个函数?设置回调?我不清楚.
Do I define a function? Set a callback? I'm unclear.
我看到有 performMailActionWithMessages
函数,但我不知道如何让它工作.
I see that there is the performMailActionWithMessages
function, but I can't figure out how to get it working.
非常感谢任何指导!
推荐答案
我终于想通了:
function performMailActionWithMessages(messages) {
messages.forEach( function(message) { // if you want to iterate
})
};
这篇关于使用 JavaScript 实现自动化而不是 AppleScript 的邮件规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文