Set URL for Selected Text in PDF

When I try to set or get the URL value of selected text - nothing happens. Script compiles, runs, no errors, but property doesn’t change…

tell application id "DNtp"
	set theItem to front document window
	set URL of selected text of theItem to "omnioutliner:///open?row=lWOeIYP9Ddi"
end tell

Document window is open, text is selected, I see it… What I do wrong?
I need the AppleScript analog of Format-Add Link… Maybe I’m trying to use the wrong property? Because when I do it through the GUI I still don’t see the changes in this property, it is still “empty”, but the link works fine.

Only attributes of rich text can be scripted but not of formatted notes or PDF annotations.

Thank you for the answer. So, no way to set the URL to selected PDF text other than through GUI? Maybe a kind of workaround (better than GUI macro)?

In DEVONthink only via the user interface but scriptable third-party PDF editors (e.g. PDFPen) could be an option.

I thought about this, but I need other DTPO PDF info for the script (like UUID and Bookends link), so I have to annotate in DTPO… Saying that, other PDF editors like PDFPen or Skim would be harder to incorporate here, it means that I have to open this file in other app, find the selected text and then script it. Looks even worse than GUI macro :wink:

BTW, is there a way to navigate PDF by outline or bookmarks? Or just pages? I’m really interested in development of native DTPO PDF functionality. This would be really helpful.

Not yet but support for table of contents is in the pipeline (and much more).

Is it possible to find a record in DTPO by its path, something like:

set theItem to the record whose path is thePath

?

lookup records with path “some/path”

1 Like