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 ROldford/5219659 to your computer and use it in GitHub Desktop.
Save ROldford/5219659 to your computer and use it in GitHub Desktop.
Based on AddCurrentMailToTaskPaperWithSummary found at http://www.hogbaysoftware.com/wiki/AddCurrentMailToTaskPaperWithSummary. Adds a text dialog so that the actual task can be entered instead of just using the subject line (which is still the default text).
property dialogText : "Enter task here:"
tell application "Mail"
try
set theSelection to the selection
if the length of theSelection is less than 1 then error "One or more messages must be selected."
repeat with theMessage in theSelection
my importMessage(theMessage)
end repeat
end try
end tell
on importMessage(theMessage)
set theBody to ""
set theDate to ""
set messageURL to ""
set theSubject to ""
try
tell application "Mail"
set theSubject to subject of theMessage
set messageURL to "message://%3C" & (message id of theMessage) & "%3E"
end tell
set subjectDialog to display dialog dialogText default answer theSubject
set theTaskText to text returned of subjectDialog
tell application "TaskPaper"
tell front document
tell project named "Inbox"
make new entry with properties {name:theTaskText, entry type:task type}
tell task named theTaskText
make new entry with properties {name:messageURL, entry type:note type}
end tell
end tell
end tell
end tell
tell application "Growl"
set the allNotificationsList to ¬
{"Mail to TaskPaper success"}
set the enabledNotificationsList to ¬
{"Mail to TaskPaper success"}
register as application ¬
"Mail to TaskPaper" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "TaskPaper"
notify with name ¬
"Mail to TaskPaper success" title ¬
"Added to TaskPaper" description ¬
theTaskText application name "Mail to TaskPaper"
end tell
on error theError
display dialog theError
end try
end importMessage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment