Automatic Import of Visited Webpages (as PDF or HTML)

Some people (me) spend a lot of time wandering various websites, gathering source information. It’d be very, very neat to be able to set an option to import webpages automatically, as they’re visited. You could specify domains to include or exclude, specify the format they’re saved in, and so forth. It would be awesome.

I’m aware I can already do that with Bookmarklets, but I often open up as many as twenty-five or thirty tabs in the space of a few seconds, and I don’t always remember to archive them.

I guess the user experience would be as poor as “browseback” - creating PDFs or web archives in the background slows down browsing a lot, increases the memory usage and decreases the stability.

What could be done is to create a new search set in DEVONagent using the Browser > History plugin. Use “*” (without quotes) as the default search term to get all visited pages and

A more sophisticated search set could use an action script to check if results are already archived in DEVONthink or to add web archives instead of HTML pages.

That’s a good suggestion. Perhaps I’ll find it in my heart to cough up the cash for DEVONagent, which I’ve been wanting to do anyway. I’ll probably wait until DTP2 tho.

In the meantime, I made a little script to import Safari’s history into DEVONthink Pro. I’m sure it’s pretty poorly written, but it imports the entire history (even banner ads, I think :frowning:) and creates links in the root. I’ll work on improving it, but I think it’s good enough for government work.

From here, of course, you can do almost anything. Except import as PDF, but that’s doable easily with DEVONagent, IIRC.

set theSafariHistory to ((path to library folder from user domain) as string) & "Safari:history.plist"

tell application "System Events"
	set theHistoryData to property list item "WebHistoryDates" of contents of property list file theSafariHistory
	set theHistoryURL to value of property list item "" of property list items of theHistoryData
end tell

set theHistorySites to {}
set theHistoryLength to 0
repeat with thisOption in theHistoryURL
	if theHistorySites does not contain thisOption then
		copy thisOption to end of theHistorySites
		set theHistoryLength to theHistoryLength + 1
	end if
end repeat

tell application "DEVONthink Pro"
	if theHistorySites = {} then
		display dialog "Your history is empty."
	else
		repeat until theHistoryLength is 0
			set theEntry to (text item theHistoryLength of theHistorySites) as string
			create record with {name:theEntry, type:link, URL:theEntry}
			set theHistoryLength to theHistoryLength - 1
		end repeat
	end if
end tell

Edit: I didn’t think to check and see if anything like this already existed for DTP… if it does, I’m sorry :frowning:

No, there’s no such script yet. And it’s not bad at all! :open_mouth: