Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewtodd/130025 to your computer and use it in GitHub Desktop.
Save matthewtodd/130025 to your computer and use it in GitHub Desktop.
Mail Act-On applescript to schedule a Waiting For reminder in Things.
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