I’ve been trying to figure this out, but I’ve hit a bit of a dead end with my knowledge. I have an Alfred app workflow that takes a variety of input variables and then feeds a JXA script that loads a few templates, does a bunch of processing, and then creates a project in Things 3 and a related Drafts document.
When creating the Drafts document, I’m creating it using the following code:
var draft_x = 'drafts5://x-callback-url/create?tag=[MyTag]&tag=' encodeURComponent('[My Other Tag]') + '&text='; var xcurl = draft_x + encodeURIComponent(draft_text); var noteID = app.openLocation(xcurl);
app referred to is
var app = Application.currentApplication() which I believe would be the
osascript instance Alfred is using to execute the script.
That said, what I’d like to do is throw this at the end:
app.openLocation('drafts5://x-callback-url/open?uuid=' + noteID.uuid);
noteID doesn’t recieve any parameters back from the x-callback. Is there any way to have it return the UUID to the script running within Alfred so that I can open directly to the note? Ideally this could end up working, then I could embed a link to the draft directly within my Things project.