Convert HTML to Web Archive with the tags?

Hi,

I’m trying to convert a bunch of bookmarks (2000 of them) into web archives using a DT script. That’s easy. The problem is, the tags attached the bookmarks don’t get carried over to the web archives. I’ve tried tinkering with a few scripts…no luck so far. Any hints or suggestions? I’m not a scripting expert.

To be honest, I’ve already converted all the bookmarks to web archives, so a script that could transfer tags from a bookmark to a web archive of the same name would work too, but I’m less sure how to create that since, I have no starting point. (I usually tinker with the scripts that the experts have written!)

Any advice, suggestions, guidance would be much appreciated.

Thanks!

Well this is embarrassing. One minute after posting that message, I solved the problem.

I’ll pasting in the script below. It modifies a script somebody else previously wrote. It carries over the tags, and the label from the bookmark.

tell application "DEVONthink Pro"
	set theSelection to the selection
	if theSelection is not {} then
		try
			activate
			show progress indicator "Downloading..." steps (count of theSelection)
			repeat with theRecord in theSelection
				set theName to name of theRecord
				step progress indicator theName
				if exists URL of theRecord then
					set theURL to URL of theRecord
					if theURL begins with "http:" or theURL begins with "https:" then
						set theData to download web archive from theURL
						if exists parent 1 of theRecord then
							set theGroup to parent 1 of theRecord
						else
							set theGroup to missing value
						end if
						
						set theTag to tags of theRecord
						set theLabel to label of theRecord
						set theArchive to create record with {name:theName, URL:theURL, tags:theTag, label:theLabel, type:webarchive} in theGroup
						set data of theArchive to theData
					end if
				end if
			end repeat
			hide progress indicator
		on error error_message number error_number
			hide progress indicator
			if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
		end try
	end if
end tell