Batch PDF downloads from Download Manager

I am looking for an easy way to download just PDFs linked off of a given webpage-- in this case off of a MEDLINE search. I have set the download manager settings to “Office& PDF Documents” checked and “Follow Links” to “One Level.” When I add a given web link nothing seems to happen. Any advice?

Note that the websites I am using do require passwords if used off site, but if I am using them at work or via VPN they do not require any sort of login given our institutional licenses. Thanks.

If you are using DevonAgent you can modify the applescript that downloads images to just download your pdfs. I have done so on my work machine to quickly grab all pdfs from a SciFinder search… but I don’t know if the scripts would work in DevonThink.

I just checked and realized I had not followed the auto-pdf-download route because of problems with the ChemPort links, which link to an intermediate SFX page. However with the script below and some use of scanners it is much easier than all by hand…


How did you do that? I also have Devon Agent, so I would be curious to see what you did.



The SciFinder searches give me a page on ChemPort listing all references or better the SFX pages to those resources…

The script below is a modified version of the “save all jpegs” that comes with DA. It basically scans the current web page for links and only keeps those containing “DOCUMENT”, the indicator for the SFX pages. It the opens all those links in new tabs.

You could try to change this to pdf and have all links opened in new tabs. This has the advantage to open even those URLs that rely on javascript or user authetication to load as is often the case with scientific journals.

However it will display pdfs that are linked directly and not download them, requiring more input and interaction on your part. I havent found an easy way to directly add a pdf file when opened in DA or DT via the browser to DT.

I hope this helps a bit.

tell application "DEVONagent"
		if not (exists browser 1) then error "No browser windows are open."
		set link_count to (do JavaScript "document.links.length" in browser 1)
		if (link_count as string) is "" then
			error "This script requires enabled JavaScript."
		else if link_count is 0 then
			error "No links in this document."
		end if
		set document_URL to (do JavaScript "document.URL" in browser 1)
		set these_URLs to {}
		set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
		set parent_URL to ((text items 1 thru -2 of document_URL) as string) & "/"
		set AppleScript's text item delimiters to od
		repeat with i from 0 to (link_count - 1)
			set this_URL to (do JavaScript "document.links[" & (i as string) & "].href" in browser 1)
			if this_URL contains "DOCUMENT" then
				set this_host to (do JavaScript "document.links[" & (i as string) & "].host" in browser 1)
			end if
		end repeat
		repeat with this_URL in these_URLs
			open tab this_URL referrer document_URL in browser 1
		end repeat
	on error error_message number error_number
		if the error_number is not -128 then
				display alert "DEVONagent" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell