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


i'm trying build mail.app rule (on os x yosemite) using javascript automation instead of applescript, i'm stuck on basics.

i see code in applescript:

using terms application "mail"     on perform mail action messages themessages rule therule         # actual code here     end perform mail action messages end using terms 

but i'm unclear how translates javascript.

do define function? set callback? i'm unclear.

i see there performmailactionwithmessages function, can't figure out how working.

any guidance appreciated!

i figured out:

function performmailactionwithmessages(messages) {   messages.foreach( function(message) {  // if want iterate   }) }; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -