Hi, I have a Scrivener project Hooked from a Markdown file. I renamed the Scrivener project, and the link from the Markdown file stopped working. Renamed the project back, and the link worked again. I thought Hook was supposed to be resilient around renames?
hook://file/ URLs are resilient to name changes.
- Scrivener: (Supports deep-linking to particular documents in Scrivener’s binder. Uses Scrivener’s
x-scrivener-item:URLs rather than
If users want to use
hook://file/ links instead they could use the default get address Hook script:
try tell application "$$" to get "file://" & path of front document on error tell application "System Events" to tell (process 1 whose frontmost is true) to value of attribute "AXDocument" of window 1 end try
and get name:
try tell application "$$" to get name of front document on error tell application "System Events" tell (process 1 whose frontmost is true) set strURL to value of attribute "AXDocument" of window 1 set fn to name of (POSIX file strURL as alias) end tell end tell end try
If the URL no longer points to what you want, the user expects it is because Scrivener is not aligned with user’s expectations.
Personally, I prefer
hook://file/ URLs rather than x-scrivener-item: URLs due to their robustness. It also means that the Hook links would be visible in any binder selection.
Your hooks are not lost, however. You can find your Scrivener links by searching for them in Hook.