Action

Save to Evernote (cross-platform)

Posted by agiletortoise, Last update over 3 years ago

NOTE: As of October, 2020, Evernote’s new Mac app update no longer supports AppleScript. If you have v10 or greater of the Evernote app installed, this action will not work on Mac.

Convert draft Markdown to HTML and save to a note in Evernote with a timestamp note name in the default notebook.

On iOS, this action uses native Evernote support through the Evernote action step. On Mac, it uses AppleScript to speak directly to the Evernote app to create the note.

Steps

  • defineTemplateTag

    name
    noteTitle
    template
    [[time]]
  • evernote (iOS only)

    nameTemplate
    [[noteTitle]]
    notebookTemplate
    tagTemplate
    [[tags]]
    template
    %%[[draft]]%%
    format
    markdown
    writeType
    create
  • script (macOS only)

    let method = "execute";
    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
    		set HTML content of theNote to htmlContent
    	end tell
    end execute`;
    
    let title = draft.processTemplate("[[noteTitle]]");
    let tags = draft.tags;
    let html = draft.processTemplate(`%%[[draft]]%%`);
    
    let runner = AppleScript.create(script);
    if (runner.execute(method, [title, tags, html])) {
    	//
    }
    else {
    	console.log(runner.lastError);
    	context.fail();
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.