Example of AppleScript to get tasks from Specific Project

I would love an example of how to use AppleScript to retrieve a list of tasks from a specific project in OmniFocus 2. The project could be specified however is logical or convenient to you; however I can think of a few ways:

  • Just the quoted name of the full project (“ELC Website”)
  • The hierarchal location: (“Work > Websites > ELC Website”)
  • What would be really cool is if we could take what we get when we right click on the project in OmniFocus and select “Copy as Link”. This is an example of what is copied:
    • omnifocus:///task/gwbloxcSWmQ
    • So I assume that this is a unique identifier: gwbloxcSWmQ and could be used in the script


1 Like
tell application "OmniFocus"
	tell default document
		set interestingProject to first flattened project whose name is "ELC Website"
		set interestingTasks to flattened tasks of interestingProject
	end tell
end tell

You could probably also do something with the unique ID, so long as your project doesn’t repeat. (The recurrences would have different IDs than the original.)


Perfect. I have tried this code on an existing script and it worked perfect.

  • Modified Code
    tell application “OmniFocus”
    tell front document
    set theModifiedProjects to first flattened project whose name is “Project Name Goes Here”
    set theModifiedTasks to flattened tasks of theModifiedProjects