Importing from DA as web archive?

Is there any way to import results frojm DA to DT as web archives rather than as HTML. Failing that, is there a way to batch convert HTML records to Web Archives?

I am find HTML records slow to load in comparison to Web Archives.

Under “Data | Add to DEVONthink”, you’ll find an option for Web Archive.

If you’d like this to become the default behavior for Cmd-I, just go to your Keyboard & Mouse Preference Pane and select the Keyboard Shortcuts pane. Press the little + icon to the lower left, select DEVONagent as your application, and for the Menu Title enter “Web Archive” (exactly like that). Make the shortcut be Cmd-I.

Now when you press Cmd-I in DEVONagent, it will import a web archive into your DEVONthink instead of an HTML page.

Now, what I’d really like is an option to batch import the results of a query as webarchives instead of as HTML pages… :slight_smile:

John

Sorry, I should have specified that I was looking for the batch archive fashion. I often get results into the hundreds and I can’t do them all one at a time.

Do you think this could be scripted somehow?

The following script downloads web archives for all results of the frontmost search window and adds them to DEVONthink Pro. But this might take “some” time.


tell application "DEVONagent"
	activate
	try
		if not (exists search window 1) then error "No search window is open."
		set theSearch to search window 1
		if searching of theSearch then error "Search is not yet complete."
		set theResults to search results of theSearch
		if (count of theResults) is 0 then error "No search results."
		tell application "DEVONthink Pro"
			if not (exists current database) then error "Please open a database before using this script!"
		end tell
		show progress indicator "Downloading..." steps (count of theResults) with cancel button
		repeat with theResult in theResults
			set this_name to title of theResult
			step progress indicator this_name
			
			if cancelled progress then exit repeat
			
			try
				set this_URL to URL of theResult
				if exists date of theResult then
					set this_date to date of theResult
				else
					set this_date to missing value
				end if
				
				set theData to download web archive from this_URL
				
				tell application "DEVONthink Pro"
					set theArchive to create record with {name:this_name, URL:this_URL, type:html, date:this_date}
					set data of theArchive to theData
				end tell
			end try
		end repeat
		hide progress indicator
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then
			try
				display alert "DEVONagent" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

1 Like