Need Hook DT3 Script to Create Bookmark instead of RTF

I am trying the Hook app for the first time and see some very interesting capabilities and a vibrant Forum with developer support which is a good sign.

Put I am a bit puzzled with DT3 integration.

If I add a new Hook and choose “Hook to a New Devonthink 3” - then the resulting item in DT3 is a blank Rich Text document.

If instead I choose “Share… Add to Devonthink 3” then the result is a Rich Text file which contains a URL Scheme link to Hook. That link works correctly if I copy/paste it into a browser; but what I would really like to do when I “Add to Devonthink 3” is to create a Bookmark to the URL Scheme link. Is this possible?

OK I see the issue - I need to revise the New Item script in Hook to create a bookmark rather than an RTF file. I tried but my Applescript skills are lacking.

This is the default script which creates an RTF file:

tell application id "DNtp"
	set newItem to create record with {name:"$title", rich text:"", type:rtf}
	set refURL to reference URL of newItem
	set itemPath to path of newItem
end tell
open location refURL
get refURL

This is my failed attempt at a revised script to create a bookmark - clearly I have much to learn in this regard. Can anyone help?

tell application id "DNtp" 
   set refURL to reference URL of newItem 
   set itemPath to path of newItem	
   create record with {name:"$title", URL:refURL, type:bookmark} in incoming group
end tell

Look at this logically…

tell application id "DNtp" 
   set refURL to reference URL of newItem 
   set itemPath to path of newItem	
   create record with {name:"$title", URL:refURL, type:bookmark} in incoming group
end tell

What is newItem ? It isn’t defined in your script so it points to nothing, hence an error.

Look at the order and syntax of the original.

  • See where the newItem is defined?
  • See how attributes are called after the item has been created _(logically, as an uncreated object has no reference URL or path?

I had tried this earlier but got no response at all.

 tell application id "DNtp"
    	set newItem to create record with {name:"$title", URL:refURL, type:bookmark}
    	set refURL to reference URL of newItem
    	set itemPath to path of newItem
    end tell
    open location refURL
    get refURL

Looking at this more closely though, the script above is designed to create a hook to a new item - that is not exactly what I want to do. Instead what I want to do is to change the behavior of the macOs “Share” feature. I am not sure where to do that

Currently the Share to DT3 feature only lets me create Plain Text, Rich Text, Formatted Note, or Markdown items. How do I change this to let me create a bookmark?

image

How do I change this to let me create a bookmark?

You can’t as it’s not supported, neither is changing the behavior of the Sharing mechanism.

OK thanks for that clarification.

In that case, I believe I can achieve the desired functionality with Keyboard Maestro instead of Applescript.