pull bookmarks from database into DTPro

I have a (relational) database of bookmarks I’d like to import into DT. Fields of value are URL, Title, Description and Tags. URL to be mapped to URL, Title to be marked to Name, Tags to Comment. Don’t know quite what to map Description to, but could simply plop it in Comments in front of the Tags stuff.

Thought was that I’d write a script (in Groovy, not that it matters) to suck the data from the database and create a applescript to import the bookmarks, one line per database record. But I’ve never written any applescript. Any hints as to what it should look like?


Answering my own question: a script that inserts one bookmark into the top level group zztest is:

tell application “DEVONthink Pro”
set thisUrl to “http://www.sun.com
if not (exists record with URL thisUrl) then
create record with {name:“Sun Home Page”, type:link, URL:thisUrl, comment:“tag and tag”} in create location “/zztest”
end if
on error error_message number error_number
if error_number is not -128 then display alert “DEVONthink Pro” message error_message as warning
end try
end tell

A cookbook for things like this for DT would sure be nice: the specification of the location is particularly obscure, and doesn’t appear anywhere in the doc that I can see.


Whoa! So that’s how you do it!

I’ve had a real bitch of a time trying to figure that out. I think I’ve even complained about it on here a time or two but to no avail.