View Single Post
Hey,

I use this great embedded AppleScript as part of my Hazel workflow for scanned documents.

I'd like to attach the document to the Omnifocus-task. Can somebody show me how?

---------------------------

-- Lovingly crafted by David Sparks, The Omni Group, and Ben Waldie --

set theDate to current date
set theTask to "whatever I need"
set theNote to "whatever extra information I need " & (theDate as string)

tell application "OmniFocus"
tell front document
set theContext to first flattened context where its name = "Internet"
set theProject to first flattened project where its name = "Single Actions"
tell theProject to make new task with properties {name:theTask, note:theNote, context:theContext, due date:theDate}
end tell
end tell
end tell

-------------------------


Ok, just incase anybody stumbles across this post, I got it running. Now my script looks like this:

-------------------------

set theDate to current date
set theDueDate to current date
set theTask to "whatever"


tell application "Finder" to set file_name to (name of theFile)
tell application "OmniFocus"
tell front document
set theContext to first flattened context where its name = "nameofthecontextIneed"
set NewTask to make new inbox task with properties {name:theTask, context:theContext, due date:theDate}
tell the note of NewTask
make new file attachment with properties {file name:theFile, embedded:true}
end tell
end tell
end tell

-------------------------

I still can't choose the project, although I must have tried a thousand possibilities, but I'm ok with this.


Thanks,

Chris


Btw OmniFocus-Help tells me I can find AppleScript documentation in the AppleScript dictionary of OmniFocus, but I just can't find this dictionary. What am I missing?
I found the AppleScript dictionary of Omnifocus. In Germany it's hidden in the AppleScript-Editor in Ablage -> Funktionsverzeichnis öffnen.

Last edited by HirnHorn; 2013-03-14 at 02:35 AM.. Reason: Solved my biggest problem