Make Hook File
Advanced section of the Title bar menu, you will find the
Make Hook File command. It’s in the Advanced section because while Hook files are extremely useful, they are not the typical way of linking information with Hook. We don’t want to confuse our users! However, we highly recommend this command to all Pro users.
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:// URL. 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.
Hook files can, alternatively, contain a Markdown link.
When you double-click or double-tap on a .hook file in the Finder, Hook parses the address, and asks macOS to open the URL in that file. It’s that simple!
In a sense, Hook files are like Finder 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. However, they are much more versatile and powerful than either type of file.
Hook files are better than macOS Finder aliases !
Hook files are better than aliases and web locations in many respects:
- Unlike Finder aliases, they are written in plain text, containing either (a) only a URL, or (b) a markdown link. That means you can edit them in your favorite editor.
- They can contain any URL (address) that your macOS instance can resolve. .hook files can contain links to files and folders, of course. But the URL scheme can be anything macOS can handle, such as omnifocus:/// , craft:///, x-devonthink-item:/// or x-nvultra: . If your Mac has an app that can open the URL, you’re good to go. For instance, DEVONthink 3 will open
- Hook does not require that the URL scheme be of an app that has automation beyond an app being able to open 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 are well behaved whe stored inside version control system and locally synced shared folders.
- .hook files can survive in many cases where Finder 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. Or when you create a .hook file pointing to a folder in a share (e.g., Dropbox) then unmount the share and remount it in a different folder.
- .hook files work across Macs (you can even share them with others .
An advantage of macOS Finder aliases is that their Finder icon mirrors the icon of the app that will open the file. In contrast, .hook files always have the same icon. However, when
Make Hook File command is applied to a file, Hook adds the file extension of the target to the file name. That gives you a clue as to what the .hook file points to. You can also rename the file to give yourself any clue you want.
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 :).
Another example, try putting this in a .hook file:
Double clicking on that .hook file will then open or reveal the
com.cogsciapps.hook in the
Application Support folder, or find all instances of them if there are many.
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 open for you.
Make Hook File command stores ‘.hook’ files in Hook’s “Hook Files” folder, which is normally:
If you want them to be elsewhere, just create a symbolic link from that folder to wherever you want.
Alternative/supplement to Hook window links
.hook files are an alternative or supplement to the HOOKED items section of the Hook window.
Havig a .hook file in a folder is a way to get a visual indication that there’s pertinent information; and of course it provides a way to get to that information. .hook files enable you to access related information without needing to invoke the Hook window. Just double click on the .hook file.
It’s sometimes useful to create a
Hook files folder in a project folder, to contain links to material related to the project. Use the
Make Hook File command to create .hook files, and then move the .hook files into the desired folder, as you might have done with Finder aliases.
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 🙂 .