√ Craft and Hook compatibility

Obviously, we recommend Craft users wait for programmatic automation, which as we have pointed out several times on this forum is better (more robust, faster, lower maintenance, supports all natural languages, etc.) than UI scripting. As @balint said, Craft will have it the next business day, and as we’ve noted we’re keen to implement Hook’s side of the integration.

That will come in a script vetted by CogSci Apps Corp. and conveniently served from Hook’s software update mechanism.

Congrats on your progress, @balint, and thanks for asking. Here’s Hook’s New Item script for Bear app.

use framework "Foundation"
use scripting additions


property NSString : a reference to current application's NSString
property NSMutableCharacterSet : a reference to current application's NSMutableCharacterSet

set callbackURL to "hook://x-callback-url/link-to-new"
set partialURL to "bear://x-callback-url/open-note%3Fid%3D"
set encodedSrc to "$encoded_link"

set callbackURL to callbackURL & "%3FpartialURL%3D" & partialURL & "%26src%3D" & encodedSrc

set encodedTitle to "$encoded_title"
set encodedLink to "$user_link"

set theString to NSString's stringWithString:encodedLink
set charset to NSMutableCharacterSet's URLQueryAllowedCharacterSet's mutableCopy
charset's removeCharactersInString:"&=?"
set encodedLink to theString's stringByAddingPercentEncodingWithAllowedCharacters:charset

set myURL to "bear://x-callback-url/create?text=[" & encodedTitle & "](" & encodedLink & ")&x-success=" & callbackURL
set myScript to "open " & quoted form of myURL

do shell script myScript

get "hook://x-callback-url/link-to-new"

We’ll also publish an x-callback-url -based New Item script for Drafts, though it might not go in Hook itself since Drafts’ AppleScript works fine. I’ll send you a copy @balint.

We’re sure Craft+Hook users will love it. Lee Garrett who is Hook & Craft user, is doing a ton of screencasts for us. We can all look forward to a screencast on robust Craft linking :wink:with Hook .

1 Like

For the record, as noted Craft v1.3.3 released, Hook from All Documents Too - Announcements - Hook Productivity Forum. This is compatible with Hook, with x-callback-url. Hook to New > Craft is coming in Hook 2.3

That page above includes a video for Hook .

1 Like