Hi there,
I’m new to Applescript and have cobbled together this script (mainly culled from many good much appreciated Web tutorials) to execute based on a mail rule:
on perform_mail_action(theData)
tell application "Mail"
set theSelectedMessages to |SelectedMessages| of theData
set theRule to |Rule| of theData
repeat with theCurrentValue in theSelectedMessages
set theMessage to make new outgoing message with properties {visible:true, subject:"subject", content:"content"}
tell theMessage
make new to recipient at end of to recipients with properties {name:(extract name from theCurrentValue), address:(extract address from theCurrentValue)}
end tell
send theMessage
end repeat
end tell
end perform_mail_action
Needless to say, it doesn’t work as I’d like - At this stage I’m just trying to reply to selected mail based on a filter rule. Firstly any help would be appreciated, however, I also wonder if anyone can tell me how to get at the Applescript data structures / API each application (in this case ‘mail’) offers.