Creating clutter-free records with AppleScript

Hi,
I’m trying to automate capture of web articles into DEVONthink Pro. Is there some way to tell DEVONthink to capture an article, based on a link, as a clutter-free record?

When I capture articles manually, I use the (excellent) web clipper to capture clutter-free either .webarchive or formatted notes from a webpage.

I manage to get a script to capture a record based on a link, but only the full webpage and not just the clutter-free text.

DEVONthink’s dictionary does not support that action directly, so you need to work with other utilities to do the heavy lifting. Such as:

  • Use the API available at heckyesmarkdown.com. There were some examples of this posted in this forum in years past. I don’t know how actively that API is maintained.
  • Grab the contents of the webpage at the other end of the URL with shell command call to CURL and then use TextUtil or Pandoc to convert the contents
  • Use GUI scripting to send the URL to Safari, press the buttons to enter reader mode, then clip back the reader-mode contents to DEVONthink

Some related threads (very verbose at times) that might offer help are at



Finally, here is one of my scripts – but it is only converting the URL to markdown, which is frequently not as good as the clutter-free version of a page:

-- Convert URLs to Markdown documents
-- Created by Christian Grunenberg on Mon Mar 23 2009.
-- Modified by korm 20140625
-- Copyright (c) 2009. All rights reserved.

tell application id "DNtp"
	set theSelection to the selection
	if theSelection is not {} then
		try
			show progress indicator "Converting..." steps (count of theSelection)
			repeat with theRecord in theSelection
				set theName to name of theRecord
				set theURL to URL of theRecord
				step progress indicator theName
				if theURL begins with "http:" or theURL begins with "https:" then
					set theGroup to parent 1 of theRecord
					create Markdown from theURL name theName in theGroup
				end if
			end repeat
			hide progress indicator
		on error error_message number error_number
			hide progress indicator
			if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		end try
	end if
end tell

An upcoming release will support this.

Thanks, that is great news!

Thanks also for the workarounds, I might experiment with them until the feature arrives.

Has the Applescript been updated to enable clutter free capture?
If not, please add my name to the list of people who would like that.
Best
Saul

No, it hasn’t. Announcements would be made on our blog or Twitter account.