FYI, we at CogSci Apps have taken advantage of DEVONthink’s automation to get deep links to PDFs. Hookmark’s Copy Link function will append the current selection of the PDF. And you can use its Copy Selection and Link to copy quotes that contain a link back to the PDF/selection. The AppleScript is exposed in Hookmark’s Script Editor:
tell application id "DNtp"
if exists (content record of current tab of window 1) then
-- current open item
return reference URL of ( current tab of window 1)
end if
if class of window 1 is equal to viewer window then
set selected_items to selection of window 1
if (count of selected_items) = 1 then
-- current selected item
return reference URL of item 1 in selected_items
end if
end if
-- selected group
return reference URL of root of window 1
end tell
Instead of window 1 I would recommend to use think window 1 which is either a document or viewer window as window 1 might be any window. This simplified version should return the same results:
tell application id "DNtp"
if exists (content record of current tab of think window 1) then
return reference URL of (current tab of think window 1)
else if (count of selected records) is 1 then
return reference URL of selected record 1
else
return reference URL of root of viewer window 1
end if
end tell
That was the code for the Get Address tab. The Get Name tab reads:
tell application id "DNtp"
if exists (content record of current tab of window 1) then
-- current open item
return name of (content record of current tab of window 1)
end if
if class of window 1 is equal to viewer window then
set selected_items to selection of window 1
if (count of selected_items) = 1 then
-- current selected item
return name of item 1 in selected_items
end if
end if
-- selected group
return name of root of window 1
end tell
Could that be simplified in similar fashion?
Hookmark and DT3 do work very well together.
Thanks for posting @LucB.
Thank you. We have updated the scripts. (Hookmark scripts optionally update automatically when our script server has been updated. It’s at version 323 now.)
As DEVONthink has specific menu items for copy line, copy page number etc., is it also possible to adjust the get adress script to just get the link address to the item? whenever I reference a document (mostly pdf) via hookmark shortcut, I get the link with current page number. however, this leaves me with many different links to the same document which renders the “see related” and “see indirectly linked” categories useless for me.
That’s a current limitation of the script. The way it is supposed to work is like for Skim, Nitro PDF, and Adobe products: you only get a deep link (to the page ) if there is a selection. I’ll ask a developer of ours to fix that. If there is no selection Hookmark should just return the URL of the entire document.