Send a new feed to Instapaper

Hey guys,

I often read news using RSS feed. There wasn’t any script available in the community that connects Devonthink and Instapaper so I made one. Hope someone finds use in it!

This is the smart rule setting and the following is the script:

on performSmartRule(theRecords)
	tell application id "DNtp"
		
		set theUsername to "Your Instapaper Email Address"
		set thePassword to "Your Instapaper Passworld"
		
		try
			show progress indicator "Sending to Instapaper" steps (count of theRecords) without cancel button
			
			repeat with theRecord in theRecords
				set theURL to (URL of theRecord)
				set theName to name of theRecord
				step progress indicator theName
				
				set theStatus to 0
				set sendArticleToInstapaper to "https://www.instapaper.com/api/add?username=" & theUsername & "&password=" & thePassword & "&title=" & theName & "&url=" & theURL
				download URL sendArticleToInstapaper
				try
					set theResponse to last downloaded response
					set theStatus to |http-status| of theResponse
					if theStatus is not 201 then error
				on error
					log message theURL info "Invalid URL (HTTPS" & (theStatus as string) & ")"
					set theGroup to create location "/Invalid URLs" in (database of theRecord)
					replicate record theRecord to theGroup
				end try
				
				set unread of theRecord to false
				
				
			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 tell
end performSmartRule
3 Likes

Thanks for contributing :slight_smile:

1 Like

This is so great. Thanks so much for sharing this! I was struggling to figure out how to keep Instapaper and DT in sync and too new to the platform to figure it out myself!

Thanks!!!

Although I do have a question. How would I get this script to run on my desktop when I clip something using DTTG, and it syncs into this location? “On Import” doesn’t work for that…

I suppose what you mean by this location is the folder where the script works and that your target workflow is:

  1. Clip something with DTTG in inbox
  2. Sync DTTG with DevonTHINK
  3. DevonTHINK moves the clipped page into a folder where the script operates on
  4. Read it on Instapaper

I am not sure if this is what you are talking about. I will just assume that this is the case.

I think in this case, you have to set up certain configuration for the inbox, such as smart rule that moves the clipped page to where the script operates on. You can set up a smart rule with a tag, or certain name included in the file name so that the smart rule can filter and the trigger should be “after synchronization.”

awesome. thanks!