Updates regarding Drafts integration: Supported

Some things to note about Hook’s inter-operation with Drafts beta, first discussed here.

First off, Drafts is an august iOS writing app that has been redeveloped for macOS. Like Hook, Drafts is currently in public beta. Drafts has an AppleScript API, which we greatly appreciate.

Drafts was missing from “Link to New”

Our bad: the “Link to New” script was missing from our Drafts integration. We’ve added it to the script server. To get the latest scripts (version 31):

  1. Invoke Hook.
  2. Access the Preferences window.
  3. Click on the Script Editor pane.
  4. Click the Update Now button (at the bottom).

This script will also be included in the next build of Hook, of course. Hook’s script server is a quick way for us to deliver script updates.

Aside on Hook’s software UI

We are in the process of simplifying Hook’s software update user interface. Software updates will be fully controlled by the Updates tab. That will make life easier for us and our customers.

Making Drafts the “Link to New” default

Drafts, and database style apps (like Things and OmniFocus), cannot currently be made Hook’s “Link to New” default. We intend to address this in the future. (We will also endeavour to allow you to specify Drafts templates.)

However, you can configure keyboard shortcuts for “Link to New” apps in Apple’s keyboard shortcut tool (System Preferences > Keyboard > Shortcuts > App Shortcuts). There, I was able to create a keyboard shortcut that mapped ⌘⇧N to Drafts. (And similarly for OmniFocus).

And there are third party tools for keyboard shortcuts.

Drafts crashes when you delete a document via its automation

Hook runs into an issue such that when you create a Drafts document via its AppleScript, and then delete the document, Drafts crashes. So if you use Hook to create a Drafts document, when you delete the draft, Draft will crash.

We have notified the developer, Agile Tortoise, about this.

Acknowledgements

We were made aware of these issues by a user via email (perhaps due to the forum being down). Thanks again to that user for letting us know. And thank you all for your comments and for reading.

Drafts 5 for macOS was released on the Mac App Store a couple of weeks ago. You’ll want to eliminate the beta version, if you’re testing with that, and go with the public release – which has minor differences.

thanks! And oops! I said Drafts Beta, but actually I was using version 5.9.8 from App Store, which is not beta. Sorry for the confusion.

The person who reported the crash to me mailed me back this morning saying he cannot reproduce the crash. And nor can I. Nor can Agile Tortoise. That’s puzzling.

So the bottom line is that Drafts automation seems to be working fine. And integration with Hook looks fine too.

(Also, the difference isn’t do to macOS. I am still on 10.4.3, and will update to 10.4.4 this morning.)

Safari on 10.14.4 has some nasty changes to the way keychain works. I haven’t noticed any Hook issues, yet.

1 Like

I’ve updated the title to say “supported” because reading through this quickly one might think that Drafts is not adequately supported, but it is.

It’s one of several great alternatives to Apple Notes – e.g., Bear app syncs properly and one can get the address of documents (URLs) for linking with Hook. (If one wants to sync notes drawn with Apple pencil, there’s Agenda).

We’ll assemble some note-taking showcases.

Thread necromancy is always a fun sport…

But I’m wondering if this new option can be used to greatly simplify the scripting for Drafts:

  • drafts://x-callback-url/getCurrentDraft?x-success=[callbackurl]

I just need to understand if Hook has a callbackurl to function. I assume so as I’ve seen others do this. I will figure it out!

Edit

The reason I’m asking is that the performance of the UI scripting for “Get Address” is, frankly, terrible. It’s maybe “only” a 2-5 second delay, but that feels like forever compared to non-UI scripted apps. I can’t take it and must find a way to fix it!

1 Like

Thanks for reviving this topic and asking. to quote my comment a few min ago in √ Craft and Hook compatibility - #14 by LucB :

Drafts recently added an x-callback-url Hook can use in its Get Address tab. However, Hook has not yet been updated for this. It was / is , coincidentally, the next item on our integration update list. We hope to publish an update tomorrow on the forum.

I.e., Hook will use that x-callback-url.

If you’re asking whether Hook itself uses x-callback-url, not currently. We’ve published an AppleScript dictionary instead.

I suppose the better question was: Can you publish an example AppleScript for Hook that makes use of x-callback-url or point me to an existing one that does? Specifically for the “Get Link” function, as I generally find the “Link to New” to be a somewhat more obvious flow.

Thanks!

1 Like

will do. And thanks for asking.