A Better Instapaper Sync for Kindle/Mac

I’ve been using my Kindle with my Instapaper feed for a few months now. It works really well, but I wanted an easier way to sync the two. The Instapaper blog recently pointed to an Automator script that makes the process much easier, but I thought I’d take it a bit further.

My variation of this Automator workflow will:

  • Detect when a Kindle is mounted.
  • Confirms if you want to sync your device with Instapaper.
  • Deletes any old Instapaper files on the device.
  • Downloads a fresh Instapaper archive and places it on your Kindle.
  • Asks if you want to dismount the Kindle, and does so if chosen.

Once you have this workflow in place all you really need to do is plug your Kindle in and wait for it to do it’s thing. Couldn’t be easier.

One issue to be aware of: while you have your Kindle mounted, any insertion of USB drives (or anything that will show up in /Volumes for that matter) will start the script. I’m looking for a workaround on that one, but it’s a relatively minor issue. Plug it in, sync it, unplug it. That’s the point of it, anyway.

You must also be signed into your Instapaper account through Safari for the Instapaper archive to be downloaded successfully. Automator uses your Safari session to grab the file.

Finally, the script should work with any number of Kindle devices, but only one may be plugged in at a time for the sync to work properly.

Download

You can download my workflow and customize it for yourself. You’ll want to move the file to your ~/Library/Workflows/Applications/Folder Actions directory and work with it from there. Alternatively, you can build the workflow manually.

Install the Workflow

  1. If you downloaded the pre-built workflow, ensure it’s been copied to the location I mentioned.
  2. Open Finder and press Control+Shift+G. In the prompt, enter “/Volumes” and press Enter.
  3. If you don’t have the path bar enabled in Finder, go to the View menu and select “Show Path Bar.”
  4. Right click “Volumes” in the path bar and select “Folder Actions Setup…”
  5. Attach the “Update Kindle with Instapaper.workflow”, ensure both checkmarks are checked.

Plug in your Kindle, and watch the magic. ;)

Build The Workflow Manually

  1. Open Automator and create a new Folder Action. Set the “receives files and folders added to” drop down to “Volumes” (select Other, then press Control + Shift + G and enter “/Volumes”, press Go and then OK.)
     
  2. Add a “Run AppleScript” action with the following code:
    on run {input, parameters}
    
    	tell application "Finder"
    		if exists disk "Kindle" then
    			return input
    		else
    			error -128
    		end if
    	end tell
    
    	return input
    end run
  3. Add a “Ask for Confirmation” action. This will allow us to cancel our Instapaper update if we’re not ready for a fresh copy.
     
  4. Add another “Run AppleScript” action to check for any existing Instapaper files on the Kindle, and move them to the trash for us.
    on run {input, parameters}
    
    	tell application "Finder"
    		set kindleFolder to "Kindle:documents:" as alias
    		set instapaperFiles to every file in kindleFolder where
    			name of it contains "Instapaper-ReadLater-"
    		move every item of instapaperFiles to trash
    
    		-- If you'd like to automatically empty your trash, uncomment:
    		--empty the trash
    	end tell
    
    	return input
    end run

    Lines 5 and 6 should be on one line.
     

  5. Add a “Get Specified URLs” action. Delete the default URL and add http://www.instapaper.com/mobi.
     
  6. Add a “Download URLs” action. Point the Where value to your Kindle/documents folder..
     
  7. Add another “Ask for Confirmation” action. This time we’ll be asking whether we want to dismount our Kindle or not.
     
  8. Add one more “Run AppleScript” action to dismount our Kindle from the file system, allowing us to just unplug the device without any further steps.
    on run {input, parameters}
    
    	tell application "Finder"
    		if exists disk "Kindle" then
    			try
    				eject "Kindle"
    			end try
    		end if
    	end tell
    
    	return input
    end run

     

Tags: , , , , ,

Leave a comment

blog comments powered by Disqus