“Create Evernote Note” from Chrome Tab using Keyboard Maestro
Here’s an example of a macro that creates an Evernote note out of the current Chrome browser tab. My goal was to just throw the current page into Evernote with its page title as the note title, and its URL as the source URL.
Step 1: Build the macro as shown below. I encourage you to tweak the Applescript, but you may want to test with the Applescript editor first.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
tell application "Keyboard Maestro Engine" set KMVarTitle to get value of variable "chromepagetitle" set KMVarUrl to get value of variable "chromeurl" end tell tell application "Evernote" if (not (notebook named "_Tasks" exists)) then make notebook with properties {name:"_Tasks"} end if set _tasks to notebook named "_Tasks" set newNote to (create note title KMVarTitle with text "" notebook _tasks) set the source URL of newNote to KMVarUrl end tell |
Step 2: Notice I didn’t set a trigger on this macro? That is because I prefer to execute browser-centric KM macros via either a bookmarklet or a link on the browser page. If that sounds interesting to you, please read my earlier post: Keyboard Maestro URL Handler (KMLink)!
Where to go from here…
The beauty of this solution comes in its flexibility. Using Evernote’s extensive Applescript support plus Keyboard Maestro leads to endless possibilities. I’m thinking about making a bookmarklet that will save pages with a specific tag, so that in one click I can save a note with a “Drupal” tag [or whatever]. I’ll probably also create a macro that creates a note and tags it based on the value of a certain element on the page; this would be great for auto-tagging my Active Collab tasks based on the project name, which is an element on the page.
The confirmation displays regardless of whether the note was created. Maybe you can come up with a way to show the actual result of the create note operation?
Here are the properties of a note, all of which you can set with your macro! See https://dev.evernote.com/doc/articles/applescript.php
UPDATE #1:
I realized it’d save me a lot of time to automatically tag my Active Collab notes automatically based on the task’s parent project. For this, I simply store the project “slug” from the URL and use that as the tag. Here’s what it looks like:
UPDATE #2:
Evernote’s Applescript handling has changed. Notes weren’t being put into my _Tasks notebook after a recent update.
Also, having an empty “with text” value started coming through as (null). Adding a space fixes this.
Here’s the new code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
tell application "Keyboard Maestro Engine" set KMVarTitle to get value of variable "chromepagetitle" set KMVarUrl to get value of variable "chromeurl" set KMVarProjectSlug to get value of variable "projectslug" end tell tell application "Evernote" if (not (notebook named "_Tasks" exists)) then make notebook with properties {name:"_Tasks"} end if set newNote to (create note title KMVarTitle with text " " notebook "_Tasks") set the source URL of newNote to KMVarUrl if (not (tag named KMVarProjectSlug exists)) then set tag1 to make tag with properties {name:KMVarProjectSlug} else set tag1 to tag named KMVarProjectSlug end if assign tag1 to newNote end tell |