Hook link with selected text?

Is there interest in a type of Hook link that includes selected text from the source? I’m thinking about a situation where I want to include additional text from a pdf file or web page like a title, author name, or quote in my new Hook note.


You can do this now by creating a Hook to New script.

Does anyone have any examples of this type of thing?

I have no experience in such scripting.

Can anyone point me in the direction to learn how to edit a “Hook to New” script so it can acquire selected text?

I’m willing to learn, but I’m not finding the help I need in the support documents or forum.


1 Like

Thanks for asking Timothy,

On this page Creating and Modifying Integration Scripts – Hook, you will find a section “Tutorial examples: Things , Xcode, Agenda and More” which links to a bunch of examples.

We have an internal feature request to provide some variants of Hook to New and Copy Link that will deal with the selection.

  • Copy Quote and Link: this would copy both the quote and the link.
  • Hook to New and Copy Quote would Hook to New and copy the text so that you can paste it in the newly created item. That way, there would be no need to update every integration script.

There may be other variants.

Hook already has some alt / advanced commands when you hold down option key while selecting a menu. There will be more of them.

Hook Version 2.3 will enhance Hook to New in other ways.

More on the above anon.

Thanks. I appreciate the continuing development of Hook and look forward to the new features.

Thanks. But there is no guidance anywhere that I can find as to how to do that. Can you be more specific?

Thanks Luc, but can you explain what the user above is talking about when he says one can make a Hook to New script that puts selected text in the note automatically? I can’t find any guidance, even at the link you provide.

Thanks for this great app.

It depends on what type of new note you’re making and what integration is available. Do you have a specific type of note you’re trying to make?

1 Like

Sorry for the delay and thanks for the kind words. The New Item scripts for Craft, Drafts and Notes scripts include incantations for pasting. But they don’t illustrate the copy aspect. The copy aspect would be to morph the title of the link, i.e., editing the Copy Link script.

A copy/quote is currently slated for a 3.x release but these target milestones can (and often) change [e.g., the “2.3” above became “3.0”] so I hesitate to make a hard commitment…


To close the loop, Hook 3.2 Public beta introduced Copy Selection and Link for some apps, based on an advanced setting currently exposed only via the Terminal defaults command, as described here: Hook 3.2 Public Beta- Release Notes – Hook. Help page to follow.

1 Like

We’ve created this Help page:

Copy Selection and Link – Hook

All: please let us know if you have comments or questions so we can answer and improve the documentation.

1 Like

The deep link will work if that file is in Finder

That doesn’t make sense. Presumably you mean the deep link will work if that file is available/present?

thanks. Well, the file actually needs to be reachable via the file system, because it is referenced via a hook://file/ link. If the user cannot get to it via Finder, then neither can Hook.

For instance, suppose it’s a file in Dropbox, but you have not loaded the share. Out of luck. If the file is in a version control system (GIT, SVN, etc.): same deal.

the main confusion the text was meant to avoid was the case where user-a sends user-b a deep link to a file. User-b can only use the deep link if he has access to the same file as user-a referenced. In the case of shared files, they initially need to have the same name, though not necessarily the same path. E.g., the person might send them the file via email. On the one hand, it may be that this is so obvious to everyone that explaining it will confuse them. On the other hand, Hook is the first app worldwide that has provided this feature so perhaps an explanation can help (maybe a better one than is given in the help page).

My confusion with the wording is that Finder is an app that accesses the file system not the file system itself. A file could be hidden in Finder (e.g. a literal hidden file, or in a package, or in part of the file system not listed in the left sidebar) and presumably Hook wouldn’t care and would work.

There’s also the ambiguity of does it mean you have to have the file displayed in an open Finder window for it to work.

I would suggest wording along the lines of:

The file must be currently accessible through the file system — the link won’t work if you share the file with someone via a cloud storage link unless they first download the file.

Hey @LucB I’m really enjoying the “copy selection and link” feature. I normally put that to use when web browsing and reading web articles. I was wondering though if it’s possible to make these links “deep.” Currently, the hook link generated from the selected text is basically the page URL… I think this is already possible since Google released a Link to Text extension for chrome way back… They even have a nice github page detailing the feature. Would it be feasible to maybe tweak the “copy selected text” script so that instead using the page URL, it instead activates the Link to Text extension so that the more granular URL is produced instead?

1 Like