Get active OmniFocus projects via shortcuts

Hello,

I am trying to list all active projects from my database and save them to a note as a type of overview/status board. I thought I could achieve this easily via iOS/iPadOS shortcuts, but its trickier than I thought:

  • „Find Projects“ only allows me to search by project name
  • „Find Items“ only allows me to find available items, but doesn’t allow me to filter by folder.

Is there a way around this? Have tried experimenting with „Get Database Omni Result“, but to no avail. Will I have to start learning Scripting for this?

Thanks in advance for any help!

You’re right. It’s not currently possible to accomplish what you want only using Shortcuts. If you already know JavaScript, the learning curse should be smoother.

In OmniFocus Omni-Automation API, there is Project.Status Class:

  • Active (Project.Status r/o)
  • Done (Project.Status r/o)
  • Dropped (Project.Status r/o)
  • OnHold (Project.Status r/o)
  • all (Array of Project.Status r/o) • An array of all items of this enumeration.

You could in principle filter all the projects in the database with Project.Status.Active as the value of its property .status.

1 Like

Thanks for the info, and the pointer towards the project.status class! Well, I’ll have to start some baby steps towards scripting.

@Flobach, you’re welcome and do ask if any doubt arises.

This should get you started:

// Paste it in Automation Console...
(() => {
    const main = () => {
        return flattenedProjects
            .filter(x => Project.Status.Active === x.status)
            .map(x => x.name)
            .join("\n")
    };
    return main();
})();

It should output the name of each one of your active projects, separated by a new line character "\n".

1 Like