Delicious Tags in DTP


first all I want to sing the gospel of DTP. It’s a great product. I have a one question, though. When I import my delicious bookmarks with the Applescript, the tags don’t seem to be imported. Is there any workaround for this?

Looking forward to your answers.

Thanks for the bug report! V2.0.2 will fix this glitch of the AppleScript suite.


many thanks for addressing the problem. The tags are imported now. There’s still a minor glitch, however.

Delicious recognizes words separated by a “blank character” as two different tags, Devonthink doesn’t do this. This means that when I import a bookmark that has two tags attached to it, e.g. “devonthink” and “productivity”, Devonthink will create a tag named “devonthink productivity”. As a consequence, that the bookmark will not show alongside other bookmarks tagged with “producitivity”.

I know this is just a minor problem, but I have a couple of hundred of bookmarks stored in delicious and having to go through all of them to fix the tags seems like a lot of work.

V2.0.3 will include this script which should do this:

-- Import bookmarks
-- Created by Christian Grunenberg on Mon Jan 23 2006.
-- Copyright (c) 2006-2009. All rights reserved.

-- If the properties pUser and pPassword are undefined and the keychain doesn't contain a key for,
-- then a dialog pops up asking for these properties

property pUser : ""
property pPassword : ""

tell application id "com.devon-technologies.thinkpro2"
		if (pUser is "") or (pPassword is "") then
				tell application "Keychain Scripting"
					set theKey to first Internet key of current keychain whose name is ""
					set pUser to account of theKey
					set pPassword to password of theKey
				end tell
			end try
		end if
		repeat while (pUser is "") or (pPassword is "")
			set theResult to display authentication dialog "" & return & ""
			set pUser to user of theResult
			set pPassword to |password| of theResult
		end repeat
		set theXML to download markup from "" user pUser password pPassword encoding "UTF-8"
		if theXML is missing value or theXML is "" then
			error "Download failed."
		else if theXML contains "503 Service Temporarily Unavailable" then
			error "503 Service Temporarily Unavailable"
				tell application "System Events"
					set x to make new XML data with data theXML
					set theElements to XML elements of (XML element 1 of x) -- posts
					tell application id "com.devon-technologies.thinkpro2"
						set theGroup to get record at "/"
						if theGroup is missing value or type of theGroup is not group then
							set theGroup to create location "/"
							set thumbnail of theGroup to ""
						end if
					end tell
					repeat with theElement in theElements
						set theURL to (value of XML attribute named "href" of theElement) as string
						set theName to (value of XML attribute named "description" of theElement) as string
						set theTag to (value of XML attribute named "tag" of theElement) as string
						set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "}
							set theTags to (text items of theTag)
						on error
							set theTags to {}
						end try
						set AppleScript's text item delimiters to od
						tell application id "com.devon-technologies.thinkpro2"
							if not (exists record with URL theURL) then create record with {name:theName, type:bookmark, URL:theURL, tags:theTags} in theGroup
						end tell
					end repeat
				end tell
			on error msg
				set pUser to ""
				set pPassword to ""
				error "Invalid user/password."
			end try
		end if
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

Many thanks. That solved the problem!