email - Mail Rules using JavaScript for Automation instead of AppleScript - Stack Overflow

I'm trying to build a Mail.app rule (on OS X Yosemite) using Javascript for Automation instead of

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.

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

but I'm unclear how this translates to JavaScript.

Do I define a function? Set a callback? I'm unclear.

I see that there is the performMailActionWithMessages function, but I can't figure out how to get it working.

Any guidance is very much appreciated!

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.

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

but I'm unclear how this translates to JavaScript.

Do I define a function? Set a callback? I'm unclear.

I see that there is the performMailActionWithMessages function, but I can't figure out how to get it working.

Any guidance is very much appreciated!

Share Improve this question asked May 14, 2015 at 17:30 Daniel MorrisonDaniel Morrison 3111 silver badge4 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 14

I finally figured it out:

function performMailActionWithMessages(messages) {
  messages.forEach( function(message) {  // if you want to iterate
  })
};

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742348971a4427122.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信