Convert to Webarchive

I don’t know anything about apple scripting, just how to use them :slight_smile:

I was wondering if someone here can update the Convert to Webarchive script so that the converted file stays in the same place. For some crackpot reason the file is moved to the top group, it is really annoying.

On a slightly related note, I think this action should be part of the convert submenu (and contextual menu).

You could use this script (I guess I’ve already posted this in the forum but don’t know where :wink:)


-- Convert URLs to web archives
-- Created by Christian Grunenberg on Wed Mar 15 2006.
-- Copyright (c) 2006. All rights reserved.

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 theArchive to create record with {name:theName, URL:theURL, type:html} in theGroup
						set data of theArchive to theData
					end if
				end if
			end repeat
		end try
		hide progress indicator
	end if
end tell

Christian,

What can I add to this script so that it “replaces” the HTML page with the new webarchive (i.e. gets rid of the html page)?

As this script performs only the most basic error checking, this is definitely not recommended.