Capture web pages from many selected bookmarks at once?

I have a large list of bookmarks in DT Pro Office and I want to do the following for all of them (with one command):

Select bookmark
Load webpage
capture webpage for offline usage (HTML format?!)

Can I do that with an Apple Script or is there already a ready-made command for that?
The problem is: the “capture web page” command is only in the context menu of the displayed page, so I can not launch it for several selected pages at once.

You could use the “Convert URLs to …” scripts available in the support assistant (see e.g. Scripts > More Scripts…)

thanks, Christian,

not bad already, however it does not have the same result as “Seite erfassen” in the context menu:

It seems that the script creates a web archive.
Is there also a script which can store as “HTML” like “Seite erfassen” with the title of the webpage etc.?

Just replace the line…


create web document from theURL name theName in theGroup

…with…


set theSource to download markup from theURL
create record with {name:theName, URL:theURL, source:theSource} in theGroup

thank you, Christian.
I tried that.
There is a conversion window with status bar, but I do not find the new document.
Do I have to enter a target group or DB in the script?

It should be located in the same group as the original item.

sorry, I don’t find the created record.
Did you try the script yourself?

This is the complete code of my script:

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

tell application id "com.devon-technologies.thinkpro2"
	set theSelection to the selection
	if theSelection is not {} then
		try
			show progress indicator "Converting..." steps (count of theSelection)
			repeat with theRecord in theSelection
				set theName to name of theRecord
				set theURL to URL of theRecord
				step progress indicator theName
				if theURL begins with "http:" or theURL begins with "https:" then
					set theGroup to parent 1 of theRecord
					--create web document from theURL name theName in theGroup
					--added lines according to: http://www.devon-technologies.com/scripts/userforum/viewtopic.php?f=2&t=13758&p=64513#p64513
					set theSource to download markup from theURL
					create record with {name:theName, URL:theURL, source:theSource} in theGroup
				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

Sorry, I posted an older code snippet, the latest (and tested :slight_smile:) one looks like this:


set theSource to download markup from theURL
create record with {name:theName, type:html, URL:theURL, source:theSource} in theGroup

thank you, works much better now.
:smiley:

However it does not exactly the same thing as “Seite erfassen”:
at least the name of the new record is not the title of the page but the name of the old object. How could I change that?

Just insert the line…


set theName to get title of theSource

…right before the line “create record with… {}”.

thanks!