Using Hookmark with Drafts

Drafts is a popular document capture and editing tool by Agile Tortoise.

Hookmark enables you to link Drafts documents to and from anything that is also linkable.

Copy Link, Copy Markdown Link and Hook to Copied Link

By default, Hookmark’s Copy Link and Copy Markdown Link in Drafts return links of the form drafts5://. You can paste those links anywhere. You can even use them on your iPad or iPhone.

Hook to New > Drafts

You can use the Hook to New command to create a new Drafts item that is hooked (bidirectionally linked) to the current resource.

The built-in Hook to New > Drafts script requires the latest version of Drafts.

If you are using an earlier version of Drafts that does not have sufficient automation for Hookmark’s current Hook to New implementation (which uses x-callback-url), you may use this in Gear menu > Preferences > Script Editor tab:

tell application "Drafts" to activate
set the clipboard to "$title"
tell application "System Events" to tell process "Drafts"
    click menu item "New with Clipboard" of menu 1 of menu bar item "File" of menu bar 1
end tell

--without this weird second activation Drafts won't actually create the new note
tell application "Drafts" to activate

set the clipboard to ""
tell application "System Events" to tell process "Drafts"
    click menu item "Link" of menu 1 of menu item "Copy" of menu 1 of menu bar item "File" of menu bar 1
end tell

delay 0.2
get (the clipboard)

“Hook” tag to Drafts items

When you create a new Drafts document using Hook to New, Hookmark will apply a “Hook” tag to it. That allows you — on Mac, iPhone or iPad — to search for every task or project that you’ve created with Hook to New. Handy!

This is an introductory feature that will be revisited. Currently these tags are not added on linking, nor are they deleted automatically.

If you would like the tag name to be something different, in the Gear menu > Preferences > Script Editor tab > Drafts > New Item tab script, just change:

Tags:{"Hook"}

to use whatever “tagName” you’d like.

If you don’t like this feature, just delete:

Tags:{"Hook"}

from that script.

See also:

Search for Drafts Hookmark-bookmarks

To find Drafts items you’ve processed with Hookmark, simply:

  1. Invoke Hookmark.
  2. Enter search mode (with ⌘F or a click).
  3. Type: url:drafts5 and hit the Return key.

Your Drafts bookmarks will show up in the search results.

Get Address with x-callback-url

If you are a Hookmark Pro user who wants to use Hookmark 2.2.1 with the Drafts app in multiple languages using Draft’s x-callback-url scheme, here’s a Get Address script you can use. As of 2021-01-23, it has only been tested on macOS Big Sur (it might work on macOS 10.15 too).

set callbackURL to "hook://x-callback-url/setCurrentNode"

set myURL to "drafts://x-callback-url/getCurrentDraft?" & "&x-success=" & callbackURL

set myScript to "open '" & myURL & "'"

do shell script myScript
return callbackURL

See also…

Drafts is discussed and illustrated elsewhere on this website. To find out more:

About this page

Page last updated for Hookmark 2.1 scripts version 142.

Hookmark is AppleInsider's Favorite Mac app of 2022!!