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 > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

AppleScript Documentation Thread Tools Search this Thread Display Modes
I am wanting to add an Entourage message to OmniFocus. I have figured this out, thanks to this forum. I am using this code:

tell application "Microsoft Entourage"
	-- get the currently selected message or messages
	set selectedMessages to current messages
	repeat with theMessage in selectedMessages
		-- parse the email(s)
		set theName to subject of theMessage
		set theContent to content of theMessage
		tell application "OmniFocus"
			set theContext to context "Waiting" of default document
			set theTask to theName
			set theNote to theContent
			tell default document to make new inbox task with properties {name:theTask, note:theContent, context:theContext}
		end tell
	end repeat
end tell
However, I alo want to assign a specific project to the new task. How can I do that? I have searched the forum but can't find an answer.

Is there somewhere I can find complete documentation for OmniFocus' AppleScript interface?

Have you looked at the OmniFocus dictionary in Script Editor?

Looks like you could set the assigned container (after looking it up) and tell the document to compact (appears to be what the Clean Up button does).
This is a little over my head. Can you (or someone else) post a code snippet? Thanks.
In case you haven't figured out how to do it yet, here's how I accomplished this:

tell application "OmniFocus"
	tell default document
		set theProject to project "Follow Up"
		set theContext to context "Online" of context "Mac" of context "Home"
		set newTask to make new inbox task with properties {name:taskName, note:taskNote, context:theContext}
		set assigned container of newTask to theProject
		compact -- Clean up the task from the inbox since it has project and context
	end tell
end tell
The key is the two lines after "set newTask". The first assigns it to the project represented by theProject, and the second is equivalent to pressing the "Clean Up" toolbar button within OmniFocus itself.

Hope this helps. :)


This is working beautifully! Thanks. I would have never figured it out on my own.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outdated documentation natkin OmniFocus 1 for Mac 6 2012-06-08 12:24 PM
OmniFocus PDF documentation jonwhite OmniFocus for iPad 2 2010-09-15 02:37 PM
AppleScript-Omnigraffle Documentation? Daria OmniGraffle General 2 2009-07-22 12:18 PM
Where is the documentation? revheck OmniFocus 1 for Mac 10 2008-01-08 04:57 PM
Documentation bronxbomber92 Omni Frameworks 1 2007-01-14 03:13 PM

All times are GMT -8. The time now is 02:03 AM.

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