Linking to OmniFocus projects/tasks via CLI or automation?

Hi all,

I’m building a Python- and Alfred-based research workflow that integrates Zotero, DEVONthink, Obsidian, OmniFocus, and Hookmark.

The automation does the following:

  • Creates a literature note in Obsidian, templated via Templater and populated from Zotero.

  • Locates the matching PDF (indexed in DEVONthink) and links everything together:

    • zotero://select/items/@citekey

    • x-devonthink-item://...

    • obsidian://adv-uri?...

  • Uses the hook CLI to hook link these three items to each other – works beautifully.

I also have a read mode that creates a sequential OmniFocus project via JXA. This project includes two recurring daily tasks (e.g., “Read X”, “Process highlights”), tagged and estimated.

Here’s the challenge:

I’d love to Hookmark the OmniFocus project (and/or its top-level task) to the note (either directly or in Obsidian), Zotero item, and PDF (either directly or in DEVONthink).

But every time I run hook link obsidian://... omnifocus://task/..., I get bookmark not found.

I’ve confirmed that:

  • The project is created and visible in OmniFocus
  • The omnifocus:///task/PROJECT_ID URI opens correctly
  • hook link works fine with all other file/URL schemes (DEVONthink, Zotero, Obsidian, Finder)

But OmniFocus URIs don’t seem to be resolvable by hook, even if the project/task is in the foreground or manually opened.

My questions:

  1. Is it possible to programmatically create Hookmark bookmarks for OmniFocus items (via CLI, AppleScript, or anything else)?

  2. Can omnifocus://task/... links ever be used in hook link, or are they not supported?

  3. Is there any workaround to make OmniFocus projects discoverable by Hookmark so they can participate in hook link automation?

  4. Would pinning the project or task manually via the Hookmark UI make it available to CLI commands?

Thanks for any insight – and thanks for the incredible tool!

fort

1 Like

I managed to get the hooks to and from OmniFocus working. The problem appears to have been due to a bug in OmniFocus, where links to projects aren’t well-formed and of the schema omnifocus:///task/<uri> instead of omnifocus:///project/<uri>. I’ve settled for a hook to a task instead, which works just as well for my purposes.

If anyone’s interested in the Alfred workflow, you can download it from here: GitHub - fortin/Literature-Linker: An Alfred research workflow - integrates Zotero, Obsidian, DEVONthink, OmniFocus, and Hookmark

2 Likes