Valet: Turning Evernote into an Obsidian Clipper [MacOS]

Overview

Valet is turning Evernote into a rudimentary Obsidian clipper. I am a coding-infant so it is just an AppleScript that can surely be refined way further, yet I wanted to share it in case it is helpful for others.

What Valet does is that it grabs the notes from an Evernote Notebook ("!valetInbox"), exports them, transforms the notes into Markdown and places them directly in your Obsidian vault. In Evernote, the notes are backed up in a notebook called “valetArchive”.

This is a bit of a hacky solution which I haven’t fully refined yet so use with caution, backups and have a look at the code.


Requirements

Valet transfers the Evernote notes into Markdown using Yarle. So install that tool using Node.js v10.18.1.


The Script

-- PATHS
set docPath to "Macintosh HD:Users:username:Documents:"
set vaultPath to docPath & "Vault:!valetInbox" -- the path of you Obsidian Vault
set exportPath to docPath & "Valet:yarle:" -- the path of the yarle Converter

set simplePath to exportPath & "out:simpleNotes:valetExport"
set complexPath to exportPath & "out:complexNotes:valetExport"

set f to exportPath & "valetExport" & ".enex"

-- EXPORT FROM EVERNOTE

with timeout of (30 * 60) seconds
	tell application "Evernote"
		
		set Inbox to "!valetInbox" -- put in the name of your Evernote Inbox notebook here
		set Archive to "valetArchive" -- put in the notebook name of your Inbox Archive here
		set matches to find notes "notebook:" & "\"" & Inbox & "\""
		
		if (count of matches) > 0 then
			
			export matches to f
			set p to POSIX path of f
		end if
		
		repeat
			set matches to find notes "notebook:" & "\"" & Inbox & "\""
			if (count of matches) = 0 then exit repeat
			move note 1 of notebook Inbox to notebook Archive
		end repeat
		
	end tell
	
end timeout

-- TURN INTO .MD

set eP to POSIX path of exportPath

delay 2

activate application "Terminal"

delay 2

tell application "System Events" to keystroke "cd " & eP
delay 1
tell application "System Events" to keystroke return
delay 2
tell application "System Events" to keystroke "npm run start -- --enexSource=valetExport.enex --outputDir=./out --include-metadata --skip-latlng --skip-update-time --outputFormat=ObsidianMD"
delay 1
tell application "System Events" to keystroke return
delay 5
quit application "Terminal"

-- DELETE .ENEX

delay 2

tell application "Finder"
	delete file named "valetExport.enex" of folder exportPath
	
end tell

-- MOVE TO OBSIDIAN

delay 1

tell application "Finder"
	move entire contents of folder simplePath to folder vaultPath
	move entire contents of folder complexPath to folder vaultPath
end tell

-- NOTIFICATION
display alert "Valet" message "Successful transfer!"

Tweaks

Make sure to change the file paths so they work for your directory. I also embedded the automated creation of the notebooks yet so make sure to either create the Notebooks with the appropriate name or change the code.

If you are more experienced than me with this sort of code or run into problems, let me know and I will try to tweak or help out. I’m on discord as @selfire as well :slight_smile:


Why this hacky solution?

Valet is far from perfect but it offers a rudimentary solution to a problem I had: I needed a funnel for the content I wanted to continue working on in Obsidian. Evernote is a reliable filling cabinet, also available on mobile and through IFTTT or Zapier it integrates with everything everywhere.

Valet funnels everything directly into Obsidian, ready for me to work on it.

3 Likes