Hook’s automatic software update (if enabled) automatically updates Hook’s integration scripts without you needing to relaunch Hook. Using Hook’s Check for App Updates and Update Scripts command also updates the scripts, without you needing to relaunch Hook.
I saw there is now a v6 of Calibre. Among the features/updates listed is a url scheme, and the site indicates:
Clicking on calibre:// URLs can be used to have calibre perform various actions. This can be used to create links to individual books and even locations inside books that can be accessed from other programs. For details, see: the manual.
It’s wonderful to be able to simply link to a specific location in a Calbre ebook using Hookmark (the way one can now in Kindle). One can create such links within Calibre, but it would be faster and easier to be able to create this link with Hookmark. Is it possible? I have not been able to do it.
To be more clear: I mean it would be wonderful to create deeplinks with Hookmark to specific locations in books in Calibre library. The capability is supposed to be in Calibre (according to the Calibre manual), but I have not been able to make it work. What I would like is to be able to create deeplinks with Hookmark in the way one can now do in Kindle. Is it possible?
Thank you for asking, @Harold_Sjursen . That would be possible if Calibre provides an API ( AppleScript, x-callback-url or something) to get a deep link. I couldn’t tell from looking at that page.
Is there a command in a menu to get the deep link ? I have not used the app in a while.
I know this issue has been discussed, but Calibre keeps releasing updated versions and some of what may have been possible (and may still be possible) is not clear – the Calibre manual is hard to follow. Anyway, what I can do is highlight a section in a book in my Calibre library and then export that highlighted portion + any notes I want to add, in md format. A link comes along with it. I can paste this highlighted portion + notes + link into an Obsidian note, where I will have already written something on the topic. Of course the Calibre export is way more than I want in Obsidian, so I delete the highlighted text and leave the link and my note. This works OK, but is rather cumbersome. I was hoping there was a way I deeplink to locations within the Calibre library book (as is easy to do with Kindle) using Hookmark. Calibre is supposed to have an API that you can access – but I know nothing about that.
There are two ways to copy the deep link of the current location to the clipboard in Calibre E-book Viewer:
Right click, Go to → Location → Press the Copy button next to “URL for this position…”
Use the keyboard shortcut for Interface → Copy current location as calibre:// URL to clipboard
On MacOS this shortcut defaults to Ctrl+Shift+c, but it does not work for me (calibre-6.16.0.dmg).
I was able to get around this bug on my version by changing the key combo to contain a character other than an alpha character (i.e. number, symbol, function key).
To change the shortcut key combo, right click in the Calibre E-book Viewer and select:
Preferences → Keyboard shortcuts → (Interface → ) Copy current location as calibre:// URL to clipboard
Then change the the shortcut to something without a letter like: Ctrl+Shift+1
I’d like to report an issue I’m encountering with the Calibre integration.
My environment:
Hookmark version: 7.0 (build 6498)
Integration version: v.404
Calibre version: 8.16.2
Despite following the instructions in @Patrick: “Using Hook with Calibre for creating a hook to a book” and setting up the recommended keyboard shortcuts exactly as described, I’m currently unable to create a Hookmark link to a selected Calibre item.
Whenever I try to create a hook from Calibre, Hookmark displays the message:
“No linkable item found in calibre. Please ensure the document is saved or you have selected an item.”
Here’s a small tweak I use for Hookmark to copy Markdown links to books that I can paste in Obsidian.
The problem I found is that when the current script captures the author from Calibre book metadata, it captures both the author’s name and the author sort name in brackets (i.e. last name first format).
So, for example, the Markdown link for a random book would output this messy string, which looks pretty terrible as a Markdown link:
[Alice's Adventures in Wonderland by Lewis Carroll \[Carroll, Lewis\]](calibre://show-book/Calibre_Library/1573)
This may be due a different Calibre setting I have for book metadata formatting, but a) I don’t know how to change that yet in Calibre, and b) it seems to be a default Calibre setting, so I imagine others might run into this.
So, I modified the Hookmark “Get name” script slightly just to remove that extra bracketed part from the author text string, using a shell sed command. I used AI to help with the regex, so the script includes explanatory commented lines, which could be removed.
on removeBracketedText(theString)
-- Use do shell script with sed to remove text within square brackets
set quotedString to quoted form of theString
-- Regex explanation:
-- s/ : substitute command
-- \\[ : a literal opening bracket
-- [^]]* : zero or more characters that are NOT a closing bracket
-- \\] : a literal closing bracket
-- / : separator
-- /g : global flag (all occurrences)
set command to "echo " & quotedString & " | sed -E 's/\\[[^]]*\\]//g'"
set newString to (do shell script command)
return newString
end removeBracketedText
set the clipboard to ""
tell application "System Events"
repeat 10 times
keystroke "c" using {option down}
delay 0.1
set t to (the clipboard as text)
if t is not missing value and t is not equal to "" then
exit repeat
end if
end repeat
end tell
set title to paragraph 1 of t
set author to paragraph 3 of t
set text item delimiters to {": "}
set author to text item 2 of author
set author to removeBracketedText(author)
return text item 2 of title & " by " & author