updating the included EverNote import script

Hi everyone. I’m new to DevonThink, trying to get my EverNote notes moved over. I know there’s a third party script out there that does this, but it doesn’t seem like it works with the latest EverNote, and my notes are relatively simple anyway, so it seems like the script that’s included with DevonThink should do the trick. It almost does, one problem: tags aren’t being handled at all.

If you’ve never used it, the setup is simple–you go into EverNote, export a .enex file, then you run the script and select that file.

I took a look at the script (“EverNote…scpt”) and it seems like it should be relatively straightforward to add support for tags. I’m new to AppleScript, but hopefully someone with AppleScript + xml experience can help me out? Here’s what I added:

After the last “set theContent” I added…

try
set theTags to (value of XML element named “tag” of theNote) as string
on error
set theTags to “”

and then I added tags:theTags to the “tell application id” line.

Problem is this only gets me the first tag. Any easy way to parse each

foo
bar

using applescript? Thanks!

Because the .enex can have zero to N tag elements, and the Tags property in DEVONthink is a list, use:


set theTags to (value of every XML element of theNote whose name = "tag")

and then


tags:theTags

in create record with… will work as you expected.

(Thanks to this posting at stackoverflow.)

Works great! (That was my StackOverflow post… :wink:

Script here:

gist.github.com/4251290

(Do the Devon folks read these forums or should I send it there way? Would be nice to have this included in the next update…)

Doesn’t hurt to send a suggestion to Support. I’ve already pointed out the “EverNote” (s/b “Evernote”) errors in the script.