Multiple select and capture to html pages like in DTP menu

Hello there!

I have really try to learn me some scripting about to capture from a html document.

What I want to do is to multiple select any urls in DTP and when use the same function like “capture to HTML Page” in DTP from the menu by with a help with an applescript.

I have seen that DTP do the different approaches when you choose convert or capture to html inside DTP.

So I would be so happy to get a multiple selection script for this behavior to “capture to HTML Pages” :smiley:

Thanks so much in advanced!

Here’s a basic example:

tell application id "DNtp"
	repeat with theRecord in (selection as list)
		if type of theRecord is bookmark then
			set theURL to URL of theRecord
			set theHTML to download markup from theURL
			create record with {name:(name of theRecord), type:html, URL:theURL, source:theHTML} in (parent 1 of theRecord)
		end if
	end repeat
end tell

Thanks Christian!
I try the script but it seems not to work like the same behavior like the capture menu option in DTP.

Is it possible to script to get to the menu option capture and choose HTML Pages and after it’s finished it moves down in the list?

Only by using user interface scripting but that is usually not recommended as it depends on the localization and might break after updates. What exactly is different? The script is of course only a basic example and can be enhanced (an exercise for the reader :slight_smile: )

When I use the script on the links it gets 25 kb in size, when I use the menu capture option it gets 7,5 kb in size.

But I think the best solution for me is to get system events to use the menu in DTP to go to Capture HTML Page :smiley:

The HTML source of a rendered webpage can be different, e.g. if modified by JavaScript. The script command downloads only the HTML code.

Ah, I think it’s therefore it doesn’t give me the right size