Evernote example with cross-platform support via AppleScript [DEPRECATED]

NOTE: As of version 10 of the Evernote Mac app, released Sept. 2020, AppleScript support is no longer available and this technique will not work. Details of options in the integration guide

As has been noted in the integration guide, Evernote’s SDK support on the Mac is not great preventing Drafts’ native Evernote action steps from being available on the Mac platform.

Evernote’s Mac app does, however, have good AppleScript support - and with the introduction of AppleScript support in Drafts actions, it is now possible to create cross-platform Evernote actions that use the native action step on iOS, and AppleScript on the Mac.

I created an example of the “Save to Evernote” action that ships with drafts demonstrating one way to go about configuring such actions…with the Evernote action step for iOS configured to only be enabled on iOS, and a script step running the AppleScript version configured to only be enabled on Mac.

There are many variations on this possible. This version does Markdown conversion, and saves to the default notebook to a timestamped note title…but could serve as the basis of more advanced actions.

Install the cross-platform “Save to Evernote” example.

3 Likes

Can the AppleScript be modified to save to a specific notebook?

Hi!

Thank you very much for the new action!

I own two mac devices. One is a MacBook pro, and the other is a Mac Mini. I installed the action on my MacBook Pro and it worked fine. When I opened my Mac Mini and run the action there, an error showed.

error

I remember when I first installed the action on my MacBook Pro, there was an extra step asking me to locate a certain folder. I can not see the step on my Mac Mini and I wonder if it is the reason. Would you please help me with that? Thank you very much!

Have you updated Drafts to the latest version on the machine? Looks like an error you would get if you were running an older version of Drafts that did not support AppleScript.

Yes, it can easily target a specific notebook. If you modify the script text like:

let script = `on execute(titleText, tagList, htmlContent)
	tell application id "com.evernote.evernote"
		set theNote to create note with text titleText title titleText tags tagList notebook "MY-NOTEBOOK-NAME"
		set HTML content of theNote to htmlContent
	end tell
end execute`;

Just added notebook "MY-NOTEBOOK-NAME" at the end of the set theNote... line. Obviously “MY-NOTEBOOK-NAME” would be changed to the notebook you want to use.

1 Like

Thank you so much for the reply! After the upgrade, it works well for my Mac Mini too. However, I tried to use the same action on my iOS devices and got this error message. Could you please look into that? Thanks a lot!

That error means there is something in the draft you are trying to send that is not converting to valid ENML, Evernote’s HTML-like markup. Could be a number of things, but it is likely some markup in your note. If you could post and example text of a draft that causing this error, I could probably point out what the issue is.

Thank you very much for your reply. I searched in the forum and found a solution by adding “%%” on both sides of the “[[draft]]”. Now it works well. :slight_smile:

1 Like

Ah, thanks for pointing that out. Will fix the example action.

I made that change to put the note in a designated notebook. I don’t see where to customize the tag that shows up on Evernote. Thanks.

Given Evernote have a new Mac app in beta which is based on electron or some such none native framework - will this work long term?

Ian

That’s a question for Evernote in terms of what the new version of the app will support. They are not sharing their roadmap or an expected feature list, so all you can do is post a request in their forum and hope for a positive response.

No idea. I want to root for Evernote, but it’s getting hard when they continue to communicate so poorly. I’m certainly hopeful that once they get through this “rebuild” they are doing, they will offer an industry standard REST API, then they can be integrated in a reliable and consistent way across platforms.