The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Adding an attachment to a task created with AppleScript via Hazel Thread Tools Search this Thread Display Modes
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
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining file attachment types with AppleScript Kevin Yank OmniFocus Extras 1 2011-03-23 09:55 AM
New task from Mail attachment only? RFBriggs OmniFocus 1 for Mac 9 2010-06-02 01:19 PM
Get the task created in quick entry? jens OmniFocus Extras 0 2009-09-08 05:13 AM
Filter tasks created when adding by email DaleRogers OmniFocus 1 for Mac 1 2008-06-23 11:33 PM
AppleScript: adding a task dontlament OmniPlan General 3 2007-02-07 02:15 PM


All times are GMT -8. The time now is 12:09 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.