Created
September 17, 2013 13:25
-
-
Save fields/6594255 to your computer and use it in GitHub Desktop.
applescript to create reminders from mail in mountain lion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using terms from application "Mail" | |
on perform mail action with messages theMessages for rule theRule | |
tell application "Mail" | |
set theText to "This AppleScript is intended to be used as an AppleScript rule action, but is also an example of how to write scripts that act on a selection of messages or mailboxes." & return & return & "To view this script, hold down the option key and select it again from the Scripts menu." | |
repeat with eachMessage in theMessages | |
set theSubject to subject of eachMessage | |
set theBody to content of eachMessage | |
try | |
-- If this is not being executed as a rule action, | |
-- getting the name of theRule variable will fail. | |
set theRuleName to name of theRule | |
set theText to "The rule named '" & theRuleName & "' matched this message:" | |
set theText to theText & return & return & "Subject: " & theSubject | |
# display dialog theBody | |
tell application "Reminders" | |
set mylist to list theRuleName | |
tell mylist | |
make new reminder with properties {name:theSubject, body:theBody} | |
end tell | |
end tell | |
set theText to "" | |
end try | |
end repeat | |
if theText is not equal to "" then | |
display dialog theText buttons {"OK"} default button 1 | |
end if | |
end tell | |
end perform mail action with messages | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment