New Note using Drafts Fails

I’ve had a Hook license for a while, but am just now trying learn it in earnest.

My first attempt at connecting a New Note via Drafts hasn’t been good. In Preference | Notes I set the default to use Drafts from the popdown list. (I’m using Hook 2.0.3 and the paid version of Drafts 24.1.10)

But when I invoke Command-N, I get a dialog that says “No address returned. The Hook to New script for com.agiletortoise.Drafts-OSX must return a valid URL.”

I checked and there is a script for Drafts “New Item” in Preferences | Scripts.

Can anyone point me in the right direction? Thanks!

– Robert

Is your language set to English? Drafts does not yet fully support automation, so the Hook to New script uses UI scripting (which is why it is marked as √🤔 on Linkable Mac Apps – Hook), currently in English. Even in English, UI scripting does have some limitations. Having said that, we often test Hook + Drafts on our systems and I tested again and it works.

Greg Pierce, the Drafts dev, has kindly pledged to round out Draft’s AppleScript in an upcoming release.

If your macOS account is English, could you please let us know the macOS version and Drafts version?

1 Like

Hi, Luc. Thanks for the speedy reply.

Yes, my language settings are for English.

My macOS version is 10.15.5. I’m using Drafts Pro version 24.1.10.

– Robert

Sometimes there are latency issues,

where the script says:

delay 0.2

you might want to try using say 1.0, just to see if that is an issue. then you would work down to a more reasonable number that works.

Unfortunately, no. Even at 2.0 seconds, still get the same message.

I don’t know that this would make a difference (I’d have to check our testing history), but I notice you’re on 10.15.5 rather than macOS Catalina 10.15.6 Update.

Yep, I was behind so was just waiting for the dust to settle on the Big Sur update. Perhaps it’s time to pull the trigger. Let’s see if that addresses the issue.

Could you please run Hook’s New Item Drafts script in Apple’s Script Editor app (it’s in /Applications/Utilities) and let us know what happens in Drafts and the message if any that Apple’s Script Editor shows in its bottom pane?

When I tried that first, Luc, I got a message that “Script Editor is not allowed assistive access.” So I allowed that via System Preferences. Now when I run the New Item Draft script it runs but I get an empty string ("") as the only message returned in the Apple Script Editor.

Screen Shot 2020-12-08 at 4.51.59 PM

I should have asked you first whether when you select a doc in Drafts and invoke Hook you get: No Linkable Item in … – Hook. If so, please see that web page which has troubleshooting tips.

No, no. I get that. I’m definitely testing against a linkable item. A web page.

Here’s something interesting, I think. This morning there was an update to Drafts in the App Store. So I made the update to version 24.2.5. I noticed, too, that Hook had updated its script library to version 139. I was using 138 yesterday.

I immediately thought I’d try Hook and Drafts with the same web page I was testing with yesterday, which is the Screencasts Online tutorial on Hook.

It worked! How great, I thought. Tried it a few times, and Drafts dutifully brought up my note.

But then I switched to another open tab in Safari, invoked Hook and pressed ^N for a new note. Back to the same error message. Not 3 minutes later, I tried again on this second web page and Hook with Drafts worked.

So, in short, Luc, some progress but also a settling feeling that things with Hook, at least as it concerns Drafts, seem a little fragile.

– Robert

I’d like to add some of my own experiences here. When I invoke Drafts on a Chrome tab and select “Hook to New Drafts” or Command+New, I get a new Draft with the title of the web page, but no link to the web page.

Does Chrome need a bit more script to also get the URL?

I have no problem getting the link to a Draft using Hook within Drafts.

Catalina 10.15.7 (19H2)
Hook 2.0.3
Drafts 24.1.10

Thanks, @rdr. just to be clear, I was actually wondering whether when you invoke Hook on a document in Drafts itself, the Hook window is populated. i.e., doing it the other way around: Hook to New > TextEdit from a web page.

Ah, I apologize for the misunderstanding.

I just checked and Hook seems to work fine when invoked from a document in Drafts. In fact, in some cases where I was able to hook from Safari earlier today, the hook back to Safari appears in the corresponding Drafts note.

– Robert

I don’t normally use Chrome. I tested this several times , however, and in my cases the hooks were setup. E.g.,

  1. open a local HTML file in Chrome (local, given that I don’t let Chrome connect to the Internet since it cannot be trusted privacy-wise).

  2. Hook to New > Drafts

  3. invoke Hook on new draft

  4. Copy All Links

  5. paste it here:

    Items linked to Lemieux-2020-Phylogenetic analysis of SARS-CoV-2 in the Boston area highlights the role of recurrent importation and superspreading events-Lemieux2020hc-10.11012020.08.23.20178236.html

    Report generated by Hook on 09-12-2020 09:33.

The title and links are as expected, working bidirectionally.

Must be something else happening. We’ll have a look.

I’m having exactly the same issue. Increasing the delay in the script doesn’t solve it.
It does work if Drafts has a window currently open.

macOS 11.0.1 (20B29)
Hook Version 2.1 (3872)
Drafts 24.2.10

Screen Shot 2020-12-11 at 3.59.51 PM

1 Like

Sorry to say that even with the upgrade to MacOS 11.1, Hook 2.1 (3872, scripts version 141) and Drafts 24.2.10 just doesn’t work reliably for me.

Screen Shot 2020-12-17 at 1.08.33 PM

From what I can see here, this isn’t an issue limited just to me.

@LucB, any new thoughts on this front or would you say it’s time to pick another place for New notes in Hook?

– Robert

thanks for bringing that up. Well, Hook to New is just one of the linking functions (there’s Copy Link, etc.), and the Drafts dev has pledged AppleScript for Hook to New; so other things being equal, I wouldn’t recommend switching away just for the current Hook to New with Drafts. (Drafts does so much; it’s a very unique app. Greg Pierce co-invented x-callback-url , and his commitment to automation can be trusted).

2020-12-17 10:55 (PT). I’ve added a note to the https://hookproductivity.com/what-mac-apps-are-compatible-with-hook-app page (though it already listed Drafts as √🤔 meaning there are currently limitations to the integration.

1 Like

Oh, for sure. Drafts is great and I rely on it all the time. That’s primarily why I wanted to use it in concert with Hook. But I also see a lot of value in the Hook to New feature of Hook. I’m just saying I think I need to find a more reliable integration so that I can stop fiddling and get to work!

– Robert

1 Like

Yes. That is what I would recommend. Even internally at CogSci Apps , I feel that given that the Drafts automation is on its way, we should probably focus on other integrations and features.

I totally agree Hook to New is super useful. I use it many times a day.