using terms from application "Mail"
on perform mail action with messages selectedMessages
try
set theCalendar to "WorkEvents"
repeat with mail in selectedMessages
set theSummary to the subject of the mail
set theDescription to the content of the mail
set theDate to the date received of the mail
tell application "iCal"
make new event at the end of events of (every calendar whose
title = theCalendar) with properties {summary:theSummary,
description:theDescription, start date:theDate}
end tell
set read status of the mail to true
delete the mail
end repeat
on error errMsg number errorNumber
display dialog ("An error occurred: " & errorNumber as string)
end try
end perform mail action with messages
end using terms from
The following script does similar work, but creates a todo item instead of a new event. It also doesn't delete the original mail.
using terms from application "Mail"
on perform mail action with messages selectedMessages
try
set theCalendar to "WorkEvents"
--say theCalendar
repeat with mail in selectedMessages
set theSummary to the subject of the mail
set theDescription to the content of the mail
tell application "iCal"
--set theCalendar to choose from list every calendar with
prompt "Choose name or cancel"
make new todo at the end of todos of (every calendar whose
title = theCalendar) with properties {summary:theSummary,
description:theDescription}
end tell
set read status of the mail to true
--delete the mail
end repeat
on error errMsg number errorNumber
display dialog ("An error occurred: " & errorNumber as string)
end try
end perform mail action with messages
end using terms from
No comments:
Post a Comment