DT links—mechanism for pathname?

In a different thread on DT and Sente I suggested the use of DT’s links may provide a good means of integration between programs. I posted on both the Sente and the Bookends forum and discussed it a bit with the Bookends developer. Here is his final comment on it:

So what I’m wondering is if there is in fact a mechanism, or is this something that could be developed? This would allow for some tighter integration, as pdf’s could be archived in DT but still an “attachment” for citations in a bibliographic database.

I’m excited about this prospect and hope that this may be feasible.


I think a simple Applescript that would prepend “file://” to the DTPO “path” of the selected document would do the trick. It could be copied to the clipboard or whatever. Something like this:

tell application "DEVONthink Pro"
	set thePath to path of (selection as reference)
	set the clipboard to "file://" & thePath
end tell

Best, Charles

I’m not quite understanding you here.

For example, the DT link for a PDF I have is x-devonthink-item://45628085-F074-4F4E-A60C-C1BF4F035F86

In reality the path of the file is something like users/danzac/documents/MyDatabase/Files.noindex/pdf/9/PssSol.pdf

I’m wondering if there is a way to get the actual path to the item from the DT link. This path can be used by Sente or Bookends to connect the PDF to the citation.

Am I misunderstanding you?

Yes. When I said path in the reply above, I meant path. Why don’t you try the Applescript instead of assuming I don’t know what you’re talking about?



I assumed stupidity on my part, not yours :slight_smile: trying now!

One more question— once a file is placed in the Dt database (…Files.noindex/pdf/9/PssSol.pdf) does it ever get moved in the internal structure?

Charles, I’m not script savvy at all. Is there a way to your script so that it also copies the plain text link of the DT item (x-devonthink-item://4562…)

So the result of what was handed to the clipboard is
documents/MyDatabase/Files.noindex/pdf/9/PssSol.pdf {break}

thanks for the help! the script worked great.

Hey Danzac-

Post some screen clips of the input fields you’re trying to paste these URLs into in Sente and Bookends,

and also tell me what {break} means.

Do you mean a line feed? -> “\n”

Best, Charles

I’m not trying to paste them into any fields at this point, I’ll wait to hear what the developers thoughts are on that.

The break stood for a return character. I’ve tried to alter your script, but I don’t really know what I’m doing with applescript. here is what I came up with.

tell application “DEVONthink Pro”
set thePath to path of (selection as reference)
get item link
set the clipboard to “file://” & thePath & return & link
end tell

I also want the link to be the plain text version of the link, not hypertext. Once this applescript is working, I’ll pass it on to the BE developer and see if he can (1)take the path and treat it as an attachment for the citation and (2) take the DT link and add it in BE’s URL field. If it is successful with BE, I’ll suggest it to Sente’s developers as well.


Well, here you go:

tell application "DEVONthink Pro"
	set thePath to path of (selection as reference)
	set theUUID to uuid of (selection as reference)
	set the clipboard to "file://" & thePath & return & ¬
		"x-devonthink-item://" & theUUID
end tell

I switched from quite a few years of Bookends use to Sente about a year ago. I reviewed both of them just a minute ago, and their Applescript support is miserable. Further, it doesn’t look like there’s anywhere in their GUIs to actually paste a URL. Sente relies on drag-n-drop only, and Bookends uses a file dialog to setup a link. Looks like a lot of work to do what you want.

I don’t understand why you don’t just index (as opposed to import) your PDFs linked to Bookends or Sente? That’s what I’ve always done, and it fits the bill for me.

Best, Charles

I’m thinking through new ways of integrating DT with my bib. manager. (I kind of like Sente better, but I’ve been waiting for them to update their journal glossary forever and can’t do much with it until I am able to import all of my abbreviations.)

I currently do the same thing as you and it is effective enough for searching, but the classification of the PDF’s isn’t too good. I’d like to be able to archive my pdf’s in DT in nice categories, but still have the PDF’s attached to their citation.

I’d love to see script support for Sente. Not sure we’ll ever see it with Bookends.

Yes, Bookends is a very high quality product, but it’s evolution is pretty slow, especially now that Sente is moving along.

As for your journal abbreviations, try this for fun:

set theList to ""

activate application "Sente"
tell application "System Events"
	tell process "Sente"
		perform action "AXPress" of menu item "Journals" of menu 1 of menu bar item "Window" of menu bar 1
		set numRows to count of rows of table 1 of scroll area 1 of window "Journals"
		repeat with i from 1 to 10
			set fullName to value of text field 1 of row i of table 1 of scroll area 1 of window "Journals"
			set abbreviation to value of text field 2 of row i of table 1 of scroll area 1 of window "Journals"
			set issn to value of text field 3 of row i of table 1 of scroll area 1 of window "Journals"
			set theList to theList & fullName & tab & abbreviation & tab & issn & return
		end repeat
	end tell
end tell

set filePath to (path to desktop as string) & "sente-journal-glossary.txt"
set fileDescriptor to open for access filePath with write permission
write theList to fileDescriptor
close access fileDescriptor

It’s very slow, taking about 30 seconds to launch Sente and get the first 10 glossary entries.

As for categorization, Bill De Ville should weight in, but I’m coming around to what I think his position is, namely that saved searches (or searches) in DTPO replace a lot of one’s need for categorization. So I’m seeing my way to simple groupings like author and date, and keeping everything else flexible with DTPO search capability.

Best, Charles

Thanks for the script! Couple questions:
My abbreviation list is in an excel sheet, do I paste the whole thing in the actual script? I also don’t have issn’s, so I’m assuming I take out “tab & issn”, right?

As for BE and Sente, I’m still kind of torn. Sente has made some huge leaps, the links and reference surfing is great, but I’ve been impressed with BE’s additions too. I’ve been asking both developers for a long time on the forums for auto-fill of missing citation info—BE came out with it first. It does auto-fill of info when dropping a PDF now too, and retrieves missing DOI’s, or info from just the DOI. Little things like that have made a big difference. My sense is that I’ll end up with Sente eventually, and I’m excited about Sente 6. I hope scripting will be part of Sente 6, we’ll see!

As for categorization vs. indexing— doesn’t the author and date thing limit the AI? Doesn’t the AI get better with categorization?

Since you seem to be a scripting guru, let me throw a few things at you:

  1. Do you have a way to launch your Sente attachment in Devonthink (its indexed version)?
  2. Is there a script that could get the sente URL for a citation, go to its attachment in DT and add the URL to the file’s URL field in the inspector? {I’d love to be able to go back and forth quickly between the PDF attachment in DT and its citation}
  3. Same question as above, except making Sente keywords into tags on the attached PDF in DT. This would really eliminate my classification needs, as I could just make a bunch of smart groups or make them on the fly.
  4. Would there be a script that could take a DT’s link, find the matching citation in Sente, and add the link to the URL field?
  5. Lastly, you said you switched from BE to Sente. Did you have a magical way of bringing all your citations over, attachments and all?

You’ve been really helpful, thanks very much. If we ever cross paths I’ll buy you a beer (and myself a fruity drink as I don’t like beer!) :smiley:

That’s just a script for writing out a Sente journal glossary to a tab-delimited file. I’d have to rewrite it (a bit) to SET values. Nice to know you have your abbreviations in a spreadsheet. Could you post the first 10 or so here in a tab-delimited format? I’ll check that the script works with your data.

I’ll respond to your other questions tomorrow over morning coffee.

Best, Charles

Gotcha. Yep, I have my abbrevs in a spreadsheet. It was easy to import into Bookends way back in the day, but not being able to has kept me from using Sente fully. Here are the first 17 of my list of 707 abbreviations (I grabbed all the way to 17 because that was the first that has a diacritical mark).

Analecta aegyptiaca AAeg
American Academy of Religion/Society of Biblical Literature Abstracts AARSBLA
AAR/Society of Biblical Literature Ventures in Religion AARSBLVR
Acta apostolicae sedis AAS
Annales Academiae scientiarum fennicae AASF
Annual of the American Schools of Oriental Research AASOR
Anchor Bible AB
The Anchor Bible Dictionary ABD
Arbeiten zur Bibel und ihrer Geschichte ABG
Abr-Nahrain AbrN
Ancient Christian Commentary on Scripture ACCS
Acta orientalia AcOr
Ancient Christian Writers ACW
Annual of the Department of Antiquities of Jordan ADAJ
Aegyptus Aeg
Aevum: Rassegna di Scienze Storiche, Linguistiche, Filologiche Aev
Archiv für Orientforschung AfO

The file could be both moved and renamed. Therefore usage of the internal path structure is not recommended.

Ahhh. I guess this is the first question I should have asked. Okay using paths isn’t going to work.

I don’t really know. So much of my current work is with newspapers, and there’s lots of spurious text on the pages: marriage notices, display ads, etc. I’ve assumed that DTPO “AI” wouldn’t exactly shine under such circumstances.

I’m hardly a guru. (Christian is a guru!) I index my Sente PDF database, and read/highlight via Skim through DTPO.

Sente’s support for Applescript is pretty miserable, and I’m not hugely concerned with cite-while-you-write because I use Latex. My impression of Sente’s Applescript support is that it’s “push” oriented: Sente can send Applescript to an aware word processor, but isn’t really happy servicing Applescript requests.

As I said above, Sente’s not too supportive. Some this may be possible by “pushing” a citation at DTPO, but I’d have to think about it.

That was a while ago, but I don’t remember it being any problem. I had about 1500 citations/PDFs at the time. Sente didn’t/hasn’t always renamed the PDFs according to its file format, but it forms a link. This seems to be related to dragging the PDF onto the citation versus the PDF display window (which sometime is necessary if you have more than one PDF linked to a citation).

Best, Charles

Thanks for your insight Charles. If you can figure out a way to script/automate the process of adding to Sente’s journal list from my list, I’d be laughing.

I should have some down time in the next couple of days to get it done…