√ Craft and Hook compatibility

Sorry, but we have more delays with 2.2.1 … can’t provide a more specific ETA than ASAP , unfortunately.

No worries, we can wait! It’ll be worth it too.

1 Like

Hook version 2.2.1 is now available . This includes ability to put x-callback-url in Get Address, which is illustrated in Using Hook with Drafts.

    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

In our testing, the above Drafts “Get Address” script works in Big Sur but not in macOS 10.14, so we didn’t make it the default integration with Drafts. I don’t know if that’s a Drafts issue or a Hook issue — we’ll need to look into it.

Hi again, in case you haven’t seen it, Hook version 2.2.1 is now available - Releases - Hook Productivity Forum. I hope this helps.

1 Like

Just found it! Trying it all now!

Edit: OMG SO SO SO MUCH BETTER for Drafts. It’s lightning fast. There really is no comparison between the UI scripting and native linking capabilities.

1 Like

what version of macOS are you using? We haven’t tested that script on macOS 10.15 yet. I’ll propose to the team here that we update the script to make it conditional: if Big Sur, use x-callback-url, otherwise, use UI scripting; then we would release the update on Integration server so people can automatically get it.

Big Sur. It does seem to work, for what it’s worth!

1 Like

Hook integration scripts v. 156 now available — Improved linking of Drafts app documents - Releases - Hook Productivity Forum. The script Hook uses to Get Address in Drafts now in case of Big Sur now uses x-callback-url :blush: .

1 Like

Hi - Auto update of this does not seem to be working at present

image

image

Thanks for mentioning. Never a dull moment. I’ve unlisted the linked topic until that gets sorted in the Pacific morning.

1 Like

Any update here? I need to fix the Drafts script as I just messaged you privately about.

Version 156 is not available publicly yet after all due. Users on Big Sur who want the x-callback-url version can still get it from: Using Hook with Drafts – Hook. The latter doesn’t do a conditional (version) check, that’s all. I.e., it’s only for Big Sur users.

What is the status of using Hook with Craft?

My understanding is that x-callback-url support will be in Craft soon. When that is done, we and others can create integration scripts for it — compatible with Hook 2.2.1.

If Craft users would let us know here, we’ll be able to respond more promptly to the issue.

4 Likes

The following script will work with the next version of Craft (coming Mon/Tue) next week :slight_smile:
set callbackURL to “hook://x-callback-url/setCurrentNode”

set myURL to “craftdocs://x-callback-url/getCurrentPageInfo?” & “&x-success=” & callbackURL

set myScript to “open '” & myURL & “’”

do shell script myScript
return callbackURL

Also @Luc - Do you have an example for x-callback-url for the “New Item”

3 Likes

In the meanwhile, for basic Markdown Links, the Keyboard Maestro Copy as Markdown Link supports Craft.

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