Javascript question: How do I query for an existing project and make it if it does not exist in Omnifocus?

Hello, I’m new to Omni Automation and not very good at javascript so forgive any errors or oversights.
I’m trying to write a script which when given a “type” and “description”, searches for the task/folder/project/context matching “type” and with title “description”.
If not found, then create a new thing of that type.
Finally, it should output the id.primaryKey of the thing found or created.

This is what I have:

#!/usr/bin/osascript -l JavaScript

var OmniFocus = new Application("/Applications/OmniFocus.app");
OmniFocus.activate();
var inbox = OmniFocus.inbox;
var msg = "Hello World ";
console.log(String(inbox));

In explicably to me, this returns this:

rcook@MacBook-Pro-2021 (wealthyvault (master)): bin/OmniLink.js 
function () {
    [native code]
}

So, derp derp derp on me.
If I had chops, this is probably a 15 minute project but I don’t know what I’m doing. Any help? Thank you much

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.