Hook to New & DEVONThink breaks the link?

Hello, all!

A penny for your thoughts? I’m struggling somewhat with “Hook to New” and the location of these notes. The software says, “you can move these notes after they are created”, but if I move it to - or create these notes within a Devonthink database, it breaks this link and strips my Hook-note of its connection to the source item. Must the Hook-note be located within the MacOS file system to work?


Welcome to the Hook Productivity Forum @Starman.

For DEVONthink, you have a couple of choices:

  1. if you want to use DEVONthink URLs ( x-devonthink-item URL), then you’re better off doing Hook to New > DEVONthink directly.
  2. Otherwise, you can replace Hook’s built-in DEVONthink script with one that returns a hook://file/ URL, which is only advisable for files that are indexed (as opposed to in the DEVONthink database proper).

I’ll write more about the latter later. (We’ll looking into providing a script that would dynamically choose the addressing scheme based on whether the item is indexed or in DT’s DB proper.)

1 Like

There are two general cases.

Case #1. You want to move files in a DEVONthink indexed folder.

When you create a file using Hook to New, Hook normally uses the hook://file/ URL schemes to identify that file. However, if you move that file into a DEVONthink indexed folder, and then invoke Hook on that file, Hook will use its DEVONthink integration script to identify the file. By default that integration script uses the x-devonthink-item URL scheme. When you invoke Hook on that file, it will not be able to tell that this file is the “same” file as outside DEVONthink, because they have different addresses. (Think of addresses as unique identifiers.)

There are ways to get around that.

  1. you can change Hook’s DEVONthink “get address” script to use a hook://file/ address instead.
  2. you could open the file in a third-party non-DEVONthink app. For instance, if it’s a PDF file, from within DEVONthink you can open it with Preview or Skim.app. When you invoke Hook on the file in that context, Hook will use the Preview or Skim “Get Address” scripts which return a hook://file/ URL.

If, you choose option 1, then inside DEVONthink, you want to use hook://file/ addresses instead of x-devonthink-item URLs, here are some instructions: Customizing Hook Integration with DEVONthink – Hook.

NB: Whether or not you choose Option 1, Option 2 will always be available to you. Preview and Skim (and other text editing and PDF apps) know nothing about DEVONthink addressing schemes.

Case #2: However, if instead of moving these files in DEVONthink indexed folders, you import them in a DEVONthink proper database, then the previously created hooks will not be available in DEVONthink. The reason is that you are not moving the files, you are copying them into DEVONthink. So Hook can’t tell they are identical. The original files are still hooked to their source. Moreover, some of the considerations of Case 1 apply.

Updated 2021-06-15 16:18. Separated in 2 cases