Jump to content
  • 0

(Archived) Create Evernote notes from Finder Selection


John Christopher Jones

Idea

I have a folder of stuff I wanted to import into Evernote.  Papers, web clippings, old letters, etc.  In particular, I really wanted to create the notes with the same creation, modification, and filename as the original, and I wanted the Source URL to point to the original file location, in case I later realize that I need information from the file path.

 

So, I created the following AppleScript.  It takes the files selected in Finder and makes a note for each selected file, copying the creation, mod, url, and filename of the original files.

 

I hope somebody else also finds this useful.

property importNotebook : "inbox"tell application "Finder" to set selectedFiles to (selection)repeat with f in selectedFiles	tell application "Finder"		set creationDate to creation date of f		set modificationDate to modification date of f		set sourceUrl to URL of f	end tell		tell application "Evernote"		set filepath to POSIX path of (f as text)		set newNote to create note title (name of f) from file (filepath as POSIX file) notebook importNotebook		set creation date of newNote to creationDate		set modification date of newNote to modificationDate		set source URL of newNote to sourceUrl	end tellend repeat
Link to post

3 replies to this idea

Recommended Posts

I personally just hit the "Run" button in AppleScript Editor, because I only need to do this once.

 

But, we can improve on this so that you can run it from the context menu by right-clicking on any files.  Evernote 5 apparently already provides this feature, but it doesn't copy the creation date, modification, or source URL like I wanted.

 

To do this, we'll open Automator, make a new Workflow, and choose "Service" as its type.  At the top of the workflow we'll use the drop down boxes to say that "Service receives [selected documentsfiles and folders] in [any application]".

 

Now, we search in the left panel in Automator for the "Run AppleScript" action and double-click it to add it to the workflow.

 

We can use the original script I posted for Finder, but we can generalize it a little bit more so it'll work with "any application".  We'll paste the following script into the Run AppleScript action.

property importNotebook : "Inbox"on run {input, parameters}	repeat with f in input		tell application "Finder"			set f to document file (f as alias)			set creationDate to creation date of f			set modificationDate to modification date of f			set sourceUrl to URL of f		end tell				tell application "Evernote"			set filepath to POSIX path of (f as text)			set newNote to create note title (name of f) from file (filepath as POSIX file) notebook importNotebook			set creation date of newNote to creationDate			set modification date of newNote to modificationDate			set source URL of newNote to sourceUrl		end tell	end repeat		return inputend run

Save the new Automator workflow (saving it in iCloud is fine) and choose a name.  I chose to name it "Add to Evernote with file date".  Now you should be able to right click on one or more files in Finder and see the "Add to Evernote with file date" option.  It may be buried under a "Services" submenu.

 

You can also add a keyboard shortcut for the new "Service" via the "Keyboard" section of System Preferences.

 

You can read more about the adventures and options you have for invoking AppleScripts in this blog post (not mine), "Fun with the OS X Finder and AppleScript".

Link to post

Archived

This topic is now archived and is closed to further replies.

Guest
This topic is now closed to further replies.
×
×
  • Create New...