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.
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.
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
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).
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.
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