Hi, I’m trying some basic scripting of OmniFocus on MacOS with javascript. I’m using an actual script, not the console. It appears that the context is hugely different between the two.
However, I’m not clear why my simple basic scripting does not work. Can someone kindly tell me why this script throws an error:
#!/usr/bin/osascript -l JavaScript
var OmniFocus = new Application("/Applications/OmniFocus.app");
OmniFocus.activate();
var inbox = OmniFocus.inbox;
console.log("inbox length: "+ inbox.length)
console.log("Flattened projects length: "+ OmniFocus.flattenedProjects.length)
rcook@MacBook-Pro-2021 (wealthyvault (master)): bin/OmniLink.js
inbox length: 0
bin/OmniLink.js: execution error: Error: Error: Can't get object. (-1728)
Is there a javascript tutorial for Omnifocus out there? I just don’t understand why my shell script cannot do the very basic stuff that I can do easily from the Console.
Thanks for any help