# Hookmark's use of DEVONthink's automation to get deep links to PDFs

**URL:** <https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229>\
**Category:** Automation\
**Created:** [April 4, 2024, 4:22am UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229 "2024-04-04T04:22:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![LucB](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/lucb/32/9458_2.png) [@LucB](https://discourse.devontechnologies.com/u/LucB)\
**Post date:** [April 4, 2024, 4:22am UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/1 "2024-04-04T04:22:40Z")

</div>

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:

```auto
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

```

Screenshots and descriptions are on the Hookmark forum: [💡 Tip: How to Copy Quotes and Deep Links to PDFs In DEVONthink - Discussion & Help - Hookmark Forum](https://discourse.hookproductivity.com/t/tip-how-to-copy-quotes-and-deep-links-to-pdfs-in-devonthink/7736) . I’ll check back here on DEVONthink forum in case anyone has comments or questions, as many Hookmark customers are also DEVONthink users. (One can use Hookmark to bidirectionally connect these two posts. That’s what I’ve done.)

Delighted that DEVONthink has the automation to do the above – for which we received many requests.

---

<div class="post-metadata">

**Author:** ![cgrunenberg](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/cgrunenberg/32/7172_2.png) [@cgrunenberg](https://discourse.devontechnologies.com/u/cgrunenberg)\
**Post date:** [April 4, 2024, 5:32am UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/2 "2024-04-04T05:32:02Z")

</div>

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:

```applescript
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

```

---

<div class="post-metadata">

**Author:** ![Grantst](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@Grantst](https://discourse.devontechnologies.com/u/Grantst)\
**Post date:** [April 4, 2024, 11:47am UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/3 "2024-04-04T11:47:26Z")

</div>

That was the code for the Get Address tab. The Get Name tab reads:

```auto
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.

---

<div class="post-metadata">

**Author:** ![cgrunenberg](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/cgrunenberg/32/7172_2.png) [@cgrunenberg](https://discourse.devontechnologies.com/u/cgrunenberg)\
**Post date:** [April 4, 2024, 1:09pm UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/4 "2024-04-04T13:09:11Z")

</div>

> [@Grantst](#):
>
> Could that be simplified in similar fashion?

Sure, basically just use `name` instead of `reference URL`.

---

<div class="post-metadata">

**Author:** ![LucB](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/lucb/32/9458_2.png) [@LucB](https://discourse.devontechnologies.com/u/LucB)\
**Post date:** [April 6, 2024, 3:18pm UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/5 "2024-04-06T15:18:21Z")

</div>

Thank you. We have updated the scripts. ([Hookmark scripts](https://hookproductivity.com/help/preferences/script-editor/) optionally update automatically when our script server has been updated. It’s at version 323 now.)

---

<div class="post-metadata">

**Author:** ![analogue\_man](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@analogue\_man](https://discourse.devontechnologies.com/u/analogue_man)\
**Post date:** [January 16, 2026, 4:24pm UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/6 "2026-01-16T16:24:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![LucB](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/lucb/32/9458_2.png) [@LucB](https://discourse.devontechnologies.com/u/LucB)\
**Post date:** [January 16, 2026, 9:24pm UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/7 "2026-01-16T21:24:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![analogue\_man](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@analogue\_man](https://discourse.devontechnologies.com/u/analogue_man)\
**Post date:** [January 16, 2026, 10:00pm UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/8 "2026-01-16T22:00:21Z")

</div>

that would be incredible, thank you!

---

<div class="post-metadata">

**Author:** ![LucB](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/lucb/32/9458_2.png) [@LucB](https://discourse.devontechnologies.com/u/LucB)\
**Post date:** [January 20, 2026, 12:34am UTC](https://discourse.devontechnologies.com/t/hookmarks-use-of-devonthinks-automation-to-get-deep-links-to-pdfs/79229/9 "2026-01-20T00:34:26Z")

</div>

We have updated Hookmark’s integration script (now at version 404) to conform to this request. Thanks for bringing it to our attention!

You can get the update automatically by going to Hookmark’s Updates Settings page:

> **[Updates Tab – Hookmark](https://hookproductivity.com/help/preferences/updates/)**
>
> This page describes the Updates tab of Hookmark's Preferences window.
> 
> If the Automatically check for updates checkbox is checked, Hookmark will check for new versions during the app's launch. If one is found, then Hookmark will let you know.
> 
> You...
