Make Hook File
Hook files are plain text files with the “.hook” filename extension. They can contain any valid address (“URI”), whether or not the address is a hook://. For instance, you can insert a link to a website (such as https://apple.com), an OmniFocus task (such as:
omnifocus:///task/nGSe83xr2tE), or any other address for that matter.
When you double-click/tap on a Hook file in the Finder, Hook parses the address, and makes a system call to open the linked item.
Hook files are like aliases and web location (.webloc) files. Like Finder aliases they can link to other files. Like Finder “.webloc” files, they can link to web pages.
But they are better than aliases and web locations in many respects:
- They can contain any URL (address) that your macOS instance can resolve. Typically that will be files and folders, but the URL scheme can be anything your Mac can handle, such as bear:, bookreader:, x-devonthink-item:, x-nvultra:, or spotify: if your Mac has an app that can open the respective URL. For instance, DEVONthink 3 to open
- Hook does not require that the URL scheme be of an app that has automation beyond an app being able to opening the URL.
- .hook files can therefore also contain hook:// links . So a .hook file can refer to an email (hook://email), a file or folder (hook://file), or a Spotlight search (hook://search).
- .hook files work well when stored inside version control system and locally synced shared folders.
- .hook files can survive in cases where aliases break. Examples where aliases break but .hook files are fine: when they contain a hook://file URL referring to a file in a version control system repository that has been locally deleted but checked out elsewhere; or if you copy a referenced file onto a different physical medium altogether, such as an SSD drive) and then delete the original referenced file.
- You can even include Markdown links in your .hook files!
So, for example, you can put the following Markdown link in a “.hook” file:
[Make Hook File](https://hookproductivity.com/help/hook-window/make-hook-file/)
If you double click on that .hook file, Hook will ask macOS to open that web link. And you’ll be back here in your default web browser :).
Make Hook File command is a Pro feature. However, you can also construct Hook files manually by creating a plain text file that ends with
.hook. Just include in that file whatever address (URI) or Markdown link you’d like Hook to execute.
The Make Hook File command stores Hook files in Hook’s “Hook Files” folder, which is normally:
Unlike aliases to folders, you
With the “Hook to New Note” menu, you can simultaneously create, link, name and store a new file or object. The Preferences’ Notes tab is where you configure the behavior the behavior of the “Hook to New” menu. However, this tab only deals with the creation of files. We refer to these files as “notes”.
In particular, this tab determines
- in what folder the new note will be stored
- what template the new note will be based on, and
- whether the new note’s name should have a particular prefix or suffix
Use them in version control systems too
If you want to include a reference to anything in a version control system (such as Git or subversion), then put a .hook file there so you and your colleagues can quickly access it.
For example, if a document or code package folder, F1, has been replaced by another, F2, consider including in folder, F1, a .hook file pointing to folder, F2. That way, when you and your colleagues later stumble into F1 you can quickly get to the new version.
Use them in cloud synced folders (e.g., Dropbox or iCloud Drive folders)
You can include .hook files pointing to anything in Dropbox folders too. But keep these idiosyncrasies of Dropbox in mind if you want to refer to Dropbox folders.
You might even want to include in a shared folder
- a hook://email link that explains something about it,
- a link to an internal web page on the issue, or
- a link to a file in a version control system.
Discuss them on the forum
Please feel free to read and contribute to Some uses of .hook files – Discussion & Help – Hook Productivity Forum
“One app, infinite applications”
Hook’s “One app, infinite applications” slogan is also true of .hook files! Once you start using .hook files, you will realize just how useful they are. Feel free to share the fun you are having with .hook files on the Hook productivity forum 🙂 .