Macro to convert clipboard into evernote note, including title, body and filing into a notebook

Hello,

I am trying to write a macro to quickly convert the clipboard content into an Evernote note, which I do many many times a day:

One problem is that in Evernote, contrary to Apple Notes, the title and body belong to different fields. The other is that the note must be filed in a notebook.

The macro should be able to:

  • create a new evernote note

see 1,2 and 3 steps as red numbers in the image
1- insert the first line of the clipboard contents into the title of the note
2- copy the entire content of the clipboard into the body of the note
3- prompt the user for a notebook to file the note

ideally the clip could contain text, images or a combination of both.

thank you very much for your time and help

This simple script will work for plain text, but NOT for images or rich text.
For images/rich text body content, you will need to either use UI scripting to paste into the body (probably the simplest), or save the Clipboard as rich text (which would include images) and then import.

Hopefully this simple plain text script will get you started. I'm sure by now you know how to use the script in a KM Macro.


Example Output

image

AppleScript to Create New Evernote Note from Clipboard

property ptyScriptName : "Create New Evernote Note from Clipboard"
property ptyScriptVer : "1.0"
property ptyScriptDate : "2019-05-09"
property ptyScriptAuthor : "JMichaelTX"

property noteBookStr : "TEST"


set cbStr to the clipboard as text
set linesList to paragraphs of cbStr
set noteTitleStr to item 1 of linesList
set noteBodyStr to cbStr

tell application "Evernote"
  
  set oAns to display dialog ¬
    "Enter or Accept the Notebook Name" default answer noteBookStr ¬
    with title "Create New Evernote Note from Clipboard"
  
  set noteBookStr to text returned of oAns
  
  create note with text noteBodyStr ¬
    title noteTitleStr ¬
    notebook noteBookStr
  
end tell

(*
EXAMPLE CLIPBOARD:

this is the title 09 May 2019
this is the body of the text
*)

1 Like

BTW, this is a very simple task script if you use Script Debugger 7, which can easily show you the Evernote Scripting Dictionary:

create note

create note (verb)Create a new note. You must specify exactly one of 'from file', 'from url', 'with text', or 'with html'. (from [Evernote Suite](suiteref:///Evernote Suite))

FUNCTION SYNTAX

set theResult to create note from file file ¬
from url text ¬
with text text ¬
with html text ¬
with enml text ¬
title text ¬
notebook text or notebook ¬
tags list of text or list of tag ¬
attachments list of file ¬
created date

thank you very much. I am going to study the macro, test it and give you an update.
Your help is greatly appreciated.
to copy, and then paste text and image, a simple cmd-c initially → cmd-v in the body of the note should work.

I am trying to write my own version. I am grateful for your macro, but there are a few problems in terms of workflow. If I type the notebook name incorrectly, it creates a new notebook, which is understandable.
Would it be possible to extract from your apple script, only the part which takes the clipboard content → extracts only the first sentence → creates a new clip containing only that first sentence.
thanks very much !

OK, I decided to go ahead an create a complete macro for this, because it is likely to be interest to a number of people. See:

MACRO: Create New Evernote Note From Clipboard

I believe it provides your initial request to set the Body of the Evernote Note to the clipboard, including rich text and images. It also validates the NB name.

1 Like

thank you very much. I greatly appreciate the amount of work you put into this.
Ironically, what we basically need is the equivalent of the evernote web clipper used in browsers.

just as an intellectual exercise.
is it feasible to convert selected text including images (or the clipboard)→ html file → open in a browser → take full advantage of the functionalities (filling in notebook, etc) and annotation capabilities of the evernote we clipper ?
thank you again

It may be feasible, but I don't see the ROI. Once the text/image is in an EN Note, you can easily use the Evernote tools for Notebook, Tags, annotation, etc. The Note is already opened and selected to it's ready for further changes if you need them.

1 Like

yes, you are right. thanks very much