Smart Rule for converting bookmarks for PDF for authenticated web sites

I am trying to build a Smart Rule to convert bookmarks I added to DT to PDF.

These are bookmarks to authenticated web sites, for which I did authenticate in DEVONthink. When I click the link, I see the content in the DT browser. When I click the browser gear icon and select Capture > PDF (One Page), the content is saved as expected.

However, if I use the “Convert” action in a Smart Rule, the whole content is not present in the PDF, only the part accessible when not authenticated. It is as if the Smart Rule is not using the cookies/storage of the DT browser, then trying to capture content of the unauthenticated web site.

I read some similar things discussed here, however I am not sure this behavior was completely discussed.

3 Likes

An updated version of this ancient script…

…could look like this:

tell application id "DNtp"
	try
		set theSelection to the selected records
		if theSelection is not {} then
			set frontMostWindow to think window 1
			repeat with theRecord in theSelection
				set theName to (name of theRecord) as string
				set theURL to (URL of theRecord) as string
				set theWindow to open window for record theRecord
				repeat while loading of theWindow
					delay 1
				end repeat
				set theData to paginated PDF of theWindow
				set thePDF to create record with {name:theName, URL:theURL, type:PDF document} in (location group of theRecord)
				set data of thePDF to theData
				if theWindow is not the frontMostWindow then close theWindow
			end repeat
		end if
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
	end try
end tell

As this uses DEVONthink’s browser, the already authenticated web sites shouldn’t cause any issues.

5 Likes

It works perfectly, thank you very much @cgrunenberg .

1 Like

sweet!