Quick Evernote Template-based Note Creation with Launchy

Recently, I redesigned my GTD system based on Evernote as the main tool.

I believe strongly that the chosen tools should not “get in the way” of interacting with the system, so when I noticed that several of my Evernote workflows include too much repetitiveness and friction – I looked for ways to reduce that friction and enable me to concentrate on the content and not the meta.

Since I am already a fan of Launchy keyboard launcher, I sought for the ideal integration between Launchy and Evernote – something that would allow me to quickly create template-based notes in Evernote, whatever the active application is, in as frictionless way as possible, while still being flexible and powerful.

I found a couple of ideas, like Brandon’s My Simple Curiosity post on Evernote note templates, and Stephen’s Thought Asylum post on the same subject. These posts were inspiring and helpful, and I wound up developing my own solution, relying on stuff I learned from them.

The result is a collection of scripts and utilities I wrote, that does exactly what I want.

This Evernote-Launchy integration allows quick creation of parametrized template-based notes from Launchy on Windows!

What does it do?

Basically, the main script in the collection takes a couple of command-line arguments that tells it which Evernote-note-template to use, and what values to apply instead of the template parameters.

The resulting note (template + replaced values) is then imported into Evernote (to a predetermined notebook, or to one specified by the command-line arguments), and optionally opened in a separate window for further editing (also depending on command-line arguments).

The Launchy integration is based on a set of “proxy batch scripts” that are indexed by Launchy for quick execution.

Each batch script is simply a proxy to running the main script with a specific set of arguments, leaving only one free argument to be filled with the text typed into Launchy (e.g. the title of the note to be created).

The example depicted in the screenshots above should help clarifying:

  • I use Evernote to store my GTD actions lists, using tags for managing the different contexts (.Action to denote an action-note, @Online for actions that require some form of web access, and 2-Next for actions that are “next actions”).
  • The @online.bat batch script (which is indexed by Launchy) calls the main script with the note-action template, the 2-Actions notebook, the @Online action-context tag, and the typed text as the action title (2. Research re. ...).
  • The main script deduces the when-context tag from the action title (2. maps to 2-Next), and applies the tag and titles to the note-action template.
  • Then the generated note is imported into Evernote (into the specified notebook), and opened in a separate window (because the --open-note flag was specified).

This is the basic flow for action-notes creation, as customized to my GTD system.

With no more than basic programming skills (Python) anyone can customize the behavior to their specific systems!

How powerful is it?

The main script, as described above, supports special syntax in the action-title to override the command-line arguments that are set by the proxy batch script.

Most of the time, when I create a new action-note, it should go into the general actions notebook (2-Actions), with no reminder – so this is the default behavior.

But sometimes I want to use a different notebook (e.g., project-specific actions should go into their project-specific notebook), or set a reminder on the created note to a specific date and time.

To achieve this, the main script parses the action title, and extracts overriding parameters from the beginning of the title.

The syntax for overriding parameters is /paramname:Parameter value/.

Supported parameters are notebook and project for target notebook overriding, and reminder and tickle for reminder setting.

The script tries to understand date/time in natural language by using parsedatetime Python library (so it’s a dependency).

At the moment, if the specified notebook doesn’t exist, it will be created. I don’t like this behavior, and I plan to change it some time in the future. The plan is to try choosing an existing notebook that “looks like” the specified name.

Update October 2013: I implemented “lazy notebook lookup”. If the notebook specified does not exactly match an existing notebook, the script searches for partial matches instead of creating a new notebook.

First, the script looks for a maximal sub-string match – an existing notebook whose name contains the exact supplied string. If there’s more than one such notebook, then the script selects the notebook with the least unmatched characters surrounding the matched sub-string.

Second, the script looks for a maximal word-overlap match. The supplied string and existing notebook names are split on whitespace and -, and the notebook with the maximal intersection of words with the supplied string is selected.

What else?

If this sounds interesting to you, visit the GitHub project, read the README for more details, download the evernote-utils package, install it, modify it, play with, etc.

The utils package contains more stuff that I didn’t cover here, like using AutoHotkey to automate the process of new project initialization in Evernote.

This is explained in the project README, but basically it is based on a AutoHotkey script that creates an empty project-specific notebook, and the same template-based note-importing process for creating initial project notes.

The rest of the post goes into some details about the implementation, that I found interesting enough to elaborate.

Opening the imported note in separate Evernote window after creation

Mentioned shortly above, specifying the --open-note flag makes Evernote open the imported note in a separate window – a very useful feature that allows me to immediately type content into the new note (or close it if I want to get back to whatever I was doing before that).

This is much more convenient compared to the alternative way of manually opening the note after creation (open Evernote, find the note, open it…).

Interestingly enough, achieving this is far from easy!

There’s the approach described by Brandon in his blog, that uses AutoHotkey to open a note (by simulating the global new note keyboard shortcut), and pastes a template into the opened note.

I found his approach excellent for a single use-case, where the template is only plain-text note body, without a title, a reminder, tags, or a specific target notebook. If this is your use-case – then Brandon’s approach is perfect for you.

But I have other use-cases (as described in this post), for which this approach breaks.

My alternative solution is as follows:

  1. Just before importing the note into Evernote (using ENScript importNotes) I save the current system time.
  2. After creating the notes, I execute an Evernote search query (using ENScript showNotes /q 'query') that shows all notes that were created after the time saved in the previous step (this should give only the note that was just imported).
  3. Then I execute an AutoHotkey script that activates the main Evernote window, and opens the first note in the resulting query (by simulating Alt+n, o).

This usually works for me, although some times it opens the note that was highlighted before executing the query. I’m not sure why that happens. This is why I used a long sleep time between the activation of the Evernote window and the keyboard simulation (750ms).

Supporting Unicode characters

I couldn’t get this right.

When trying to create notes with Hebrew text, something breaks miserably along the way.

Further debugging required…

Auto-generating the proxy batch scripts

All of my action-note-creation proxy batch scripts are almost identical, differing only in the action context tag.

This means that if I want to change something in the way the scripts work (e.g., omit the --open-note flag, or change the default notebook) – I need to modify each script in the same tedious way.

Of course – this was enough for me to automate the process of generating these scripts! 🙂

The basic process of the main script described above is to take a template-file, apply template-parameters, and get a result file. So why not reuse the same process to generate my batch scripts?

I created a batch-script template, and implemented a sub-command that iterates over the supported action-contexts and creates a batch script for each one.

Yay automation!

Conclusion

That’s all!

If this sounds interesting to you, visit the GitHub project, read the README for more details, download the evernote-utils package, install it, modify it, play with, etc.

If you do modify and customize these tools – I’d love to hear about it (in the comments).

Actually, even if you don’t, but you find it useful – I’d also love to hear (in the comments) 🙂

No Comments Yet.

Leave a Reply