Evernote Import URL Capture

The capability to import Evernote notes into DEVONthink is a fantastic addition. I want to use it to migrate fully away from Evernote, but I have a problem with the way the importer handles URLs that individual Evernote notes link to.

For example, if I have an article saved in Evernote with the text, PDF, etc in the note content and the Evernote URL metadata field containing the original URL of the article on the web, the built-in DEVONthink importer will not import that URL. That original URL appears to be lost/ignored in the import process. The DEVONthink importer places in its own URL field a URL pointing to Evernote in the form evernote:///view/…

But my whole point in importing to DEVONthink is that I want to move away from Evernote entirely and remove its application from my Mac. The URLs referencing Evernote will be useless to me. In fact, once Evernote is deleted they will all produce errors. Instead, I want the actual original URL of the Evernote note item to be transferred into DEVONthink’s URL field. If it’s not possible to do this now, I would strongly recommend this behavior for an update.

Thanks,
Drew

This behavior is in response to people who want to use Evernote in tandem with DEVONthink. (And it’s probably a No on adding a Preference as our preferences are already loaded.)

Here’s a simple chunk of code that fixes this.

  1. Open /Applications/Utilities/Script Editor and paste this in…
tell application id "DNtp"
	if selection ≠ "" then
		repeat with thisRecord in (selection as list)
			set DTUrl to URL of thisRecord
			set URL of thisRecord to (my changeEvernoteURL(DTUrl))
		end repeat
	end if
end tell

on changeEvernoteURL(DTUrl)
	tell application "Evernote"
		set theNote to find note DTUrl
		set EvUrl to source URL of theNote
	end tell
	return EvUrl
end changeEvernoteURL
  1. When you Save the file, press Command-Shift-G and paste: ~/Library/Application Support/DEVONthink Pro 2/Scripts/Toolbar (so you could add this to your Toolbar, if desired).
  2. Select an imported Evernote file and run the script and it should change the URL as expected.

Note: Evernote must be running for this to work. Also, this will not change pure Evernote URLs (ie. notes created in Evernote). It works for web clipped items.

Another workaround is to export an ENEX file and to import this file (e.g. via File > Import > Files & Folders…)

Thank you both for the two quick suggestions. I’ve tried each and gotten them both to work well.

Drew

I had to make a slight modification to get the script to work for me. I had to explicitly set the url to an empty string if the original evernote note didn’t have one.

Also, the export as .enex and import to DT did not work for me.

tell application id "DNtp"
	if selection ≠ "" then
		repeat with thisRecord in (selection as list)
			set DTUrl to URL of thisRecord
			set URL of thisRecord to (my changeEvernoteURL(DTUrl))
		end repeat
	end if
end tell

on changeEvernoteURL(DTUrl)
	tell application "Evernote"
		set theNote to find note DTUrl
		set EvUrl to source URL of theNote
		if EvUrl = missing value then
			set EvUrl to ""
		end if
	end tell
	
	return EvUrl
end changeEvernoteURL

“Also, the export as .enex and import to DT did not work for me.”

I never could make it work either.

Could you please send such a file to cgrunenberg - at - devon-technologies.com? Thanks in advance!

Thank you so much for posting this! I’ve imported ~10K notes from Evernote, and I wanted to get rid of those URL’s.