Created
June 15, 2009 09:51
-
-
Save matthewtodd/130025 to your computer and use it in GitHub Desktop.
Mail Act-On applescript to schedule a Waiting For reminder in Things.
This file contains hidden or 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 extractName from theRecipient | |
if the name of theRecipient exists then | |
return the name of theRecipient | |
else | |
return the address of theRecipient | |
end if | |
end extractName | |
on perform mail action with messages theMessages | |
repeat with theMessage in theMessages | |
set _delegate to (extractName from first to recipient of theMessage) | |
set _name to "Waiting for response to \"" & subject of theMessage & "\"" | |
set _notes to content of theMessage | |
set _tomorrow to (current date) + 1 * days | |
set _tags to "Internet" | |
tell application "Things" | |
set _action to make new to do with properties {notes:_notes, due date:_tomorrow, tag names:_tags} at beginning of list "Next" | |
if (the first person whose name is _delegate) exists then | |
set name of _action to _name | |
set delegate of _action to (the first person whose name is _delegate) | |
else | |
set name of _action to (_delegate & ": " & _name) | |
end if | |
schedule _action for _tomorrow | |
activate | |
edit _action | |
end tell | |
end repeat | |
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