05/29/14 19:00:15

Send to OmniFocus from Dropbox

Send to OmniFocus

I just remembered of David’s post "Create OmniFocus Tasks with AppleScript" . I think this is quite handy to use with Hazel.

The following is based on my work on "Building a Cloud-Enabled Dropbox-Powered Clipboard".

This actions watches a specific folder for new content and saves text file contents as new task in OmniFocus’s Inbox. The first line will be used as task title, all other lines as note.

set fileContents to read theFile

set taskTitle to paragraph 1 of fileContents

-- compose taskNote
set remainingLines to {}
repeat with currentParagraph from 2 to (number of paragraphs of fileContents)
    set the end of remainingLines to (paragraph currentParagraph of fileContents) & "
end repeat
set taskNote to remainingLines as string

tell application "OmniFocus"
    tell default document
        set newTask to make new inbox task with properties {name:taskTitle, note:taskNote}
    end tell
end tell 

The folder I watch with Hazel is aptly called “Send to OmniFocus”.