Hi, I’d like to use OmniJS to invoke an x-call-back-url action in DEVONThink To Go, however it seems that URL.call() is only designed to call OmniJS actions in other Omni-JS-enabled application.
Is there a way to call x-callback-urls using OmniJS?
After some experimenting, it seems as if OmniJS‘s URL.call function supports calling x-callback-urls, however it seems that the function passed as a callback doesn‘t get called.
For example, the following code activates DEVONtink To Go, which calls back to OmniOutliner. However, the callback never gets executed…
var scriptURL = URL.fromString('x-devonthink://x-callback-url/get-itemlink')
scriptURL.call(function(r){console.log('a')})
I can successfully pass a number from OmniOutliner to Workflow and output it through OmniOutliner console. I cannot do the same with a string. I wonder why is that.
Interestingly, when I omit the x-callback-url part from my URL.fromString('x-devonthink://x-callback-url/get-itemlink') example, DEVONthink complains that this actions can only be used via x-callback-url and aborts the action. However, in your example it seems as if the x-callback-url part gets added automatically.
Just a followup: this was fixed in OmniOutliner 5.3 for Mac and OmniOutliner 3.1 for iOS. It’s now possible to use URL.call() with x-callback-url URLs that return arbitrary content (rather than only working for URLs that returned JSON).
I’m not sure if there has been a regression, but I’m getting the symptoms that was mentioned above when trying to call urls from omnioutliner pro. Whether I try to fetch or call a URL (bear:// in this case) the callbacks never fire and bear is never notified.
I can confirm that the URL is valid because if I console.log it and then load it in chrome, it all works as expected.