View Single Post
I've copied the following script and adapted it a bit. (I'm not sure where I copied it from since I've either deleted it or there was no contact information in the script.)

It was working fine before upgrading to Mountain Lion but now instead of creating a task in the folder "Waiting For..." with the context "Waiting For..." it creates a task in the Inbox. The task does have the correct start date (current date + 2 days).

Any help would be great.

Thanks


on run

tell application "Mail"


set _msgs_to_capture to selection

repeat with eachMessage in _msgs_to_capture
set theStart to (current date) + (2 * days)
set theDue to missing value
set theOmniTask to missing value

set theTitle to the subject of eachMessage
set theNotes to the content of eachMessage
set theContextName to "Waiting For..."
set theProjectName to "Waiting For..."

set theCombinedBody to "message://%3c" & message id of eachMessage & "%3e" & return & return & theNotes

tell application "OmniFocus"
tell default document
set newTaskProps to {name:theTitle}
set theContext to context theContextName
set theProject to project theProjectName
set newTaskProps to newTaskProps & {containing project:theProject}
set newTaskProps to newTaskProps & {context:theContext}
if theStart is not missing value then set newTaskProps to newTaskProps & {start date:theStart}
if theDue is not missing value then set newTaskProps to newTaskProps & {due date:theDue}
if theCombinedBody is not missing value then set newTaskProps to newTaskProps & {note:theCombinedBody}

tell theProject
set newTask to make new task with properties newTaskProps
end tell

end tell
end tell


end repeat

end tell

end run