Edit Evernote ENML Applescript

This Applescript just sends the currently selected note to the Evernote ENML Editor. Assign it to a hotkey using your favorite hotkey app and it’s a nice little time saver.


tell application "System Events"
set app_name to name of the first process whose frontmost is true
end tell

if (app_name is "Evernote") then
tell application "Evernote"
set noteList to selection
if (count of noteList) = 1 then
set noteGUID to my get_evernote_note_id((item 1 of noteList)'s note link)
set editURL to "http://enml-editor.ping13.net/note?n=" & noteGUID
end if
end tell
open location editURL

else
tell application "Evernote" to activate
end if

on get_evernote_note_id(this_text)
set AppleScript's text item delimiters to "/"
set the item_list to every text item of this_text
set AppleScript's text item delimiters to ""
return item 8 of item_list
end get_evernote_note_id

7 thoughts on “Edit Evernote ENML Applescript

  1. Hi. I’ve copied your script to the AppleScript editor and saved it as an application. When i run it, it shows my Evernote app but nothing else. I have a note selected and it will just bring the app to the forefront but nothign else? Am i missing a step? So i need to change anything in the script to fit my setup?

  2. Hi Nelly. You can’t save it as an Application as it is currently written, but it’s very easy to fix.
    Change your code to this:

    tell application "Evernote"
    activate
    set noteList to selection
    if (count of noteList) = 1 then
    set noteGUID to my get_evernote_note_id((item 1 of noteList)'s note link)
    set editURL to "http://enml-editor.ping13.net/note?n=" & noteGUID
    end if
    end tell
    open location editURL

    on get_evernote_note_id(this_text)
    set AppleScript's text item delimiters to "/"
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to ""
    return item 8 of item_list
    end get_evernote_note_id

  3. Here’s an AppleScript that opens up a dialog where you can edit HTML. A little harder to use than ENML editor but quicker and maybe better if you’re just making a small change.


    tell application "Evernote"

    set theNotes to selection
    set currentNote to item 1 of theNotes

    set noteTitle to display dialog "Edit HTML of \"" & title of currentNote & "\"" default answer "" & HTML content of currentNote

    try
    set HTML content of currentNote to text returned of noteTitle
    end try

    end tell

  4. Hi there,

    I’m trying to use your script with Alfred…. I created a workflow and when I run it, the script seems to do nothing…. I don’t know if it is Alfred that is borking it or not…. ideas?

  5. Hey dnk. If you look in the comments you’ll see my reply to Nelly. If you use that script instead it should work great. Xiao Jin’s script should work for you too if you’d prefer to edit locally in a pop up.

  6. Thanks for sharing this. I tried (not very hard) to get it working and failed. I *was* able to get Xiao Jin’s HTML editor going but it mangled my note pretty bad, including 3 or 4 error modals and it stripped all of my images…there’s no undo to boot.

    One of the solutions I figured out myself is the export method. Go to File > Export Note… saving the note as a *.enex file. You can then edit the file to your heart’s content – it’s just some XML with HTML mixed in. When you’re done, just double click the file and Evernote will import it (annoyingly, into a new notebook that you’ll then have to delete) then you can delete the original note and delete the exported file.

    One method with a few less steps but in a way more convoluted is described (pretty well) on WikiHow. http://www.wikihow.com/Edit-the-HTML-of-Evernote-Notes-on-a-Mac
    I think this method could easily be the best if a script could determine the data folder, and/or open the content.html file, and even close Evernote automatically beforehand.

    The entire situation is still a clusterf*ck but at least you’re not sharing your file with a third party and depending on an Internet connection to do something that should be built in. Not to mention that if Evernote’s Web Clipper worked half way decently, we wouldn’t have to be digging into the HTML so often.

Leave a Reply

Your email address will not be published.