Smart Rule for converting bookmarks for PDF for authenticated web sites

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