Who can’t read the .plist, Mail? Anyway I figure it must be something to do with context but I don’t know enough about the sandboxing rules. I will keep searching and reading but was hoping someone could give me a nudge in the proper direction.
(* create todo and flag msgs, used with Mail.app rules Update with calendar ID to support iCloud*)
on createTodo(todoMsg, msgUrl)
tell application "Calendar"
tell calendar id "8A85EB21-3F22-4D78-AE7B-FA20B07B0F7D"
set DueDate to (current date) + 5 * days
make new todo at end with properties {summary:todoMsg, due date:DueDate, priority:high priority, url:msgUrl}
end tell
end tell
end createTodo
-- using terms from application "Mail"
-- on perform mail action with messages messageList for rule theRule
tell application "Mail"
set messageList to selection --debug
repeat with a from 1 to count of the messageList
set msgId to (message id of item a of messageList)
set msgUrl to "message:<" & msgId & ">"
set fromMsg to (sender of item a of messageList as string)
if "<" is in fromMsg then
set x to offset of "<" in fromMsg
set fromName to rich text 1 thru (x - 1) of fromMsg
else
set fromName to fromMsg
end if
set subjMsg to (subject of item a of messageList as string)
set todoMsg to fromName & ":" & subjMsg
createTodo(todoMsg, msgUrl) of me
end repeat
(* tell application "Calendar"
delay 40
quit
end tell *)
end tell
-- end perform mail action with messages
-- end using terms from