Evernote with Autofill in Ubuntu

UPDATE: I no longer use Evernote. My account was compromised multiple times from overseas IPs, with no notifications from Evernote. It wasn’t until someone tried to sync a phone to my account that I was notified. I checked the logs, and discovered it had been accessed several times without my knowing. I cannot recommend using it any more. If you are interested in similar tools, check out NixNote instead. Plus, it runs in Linux or Windows. I’ve left this article up for reference only.

I’m working on integrating services like Evernote into my daily routine to help manage all the projects and things that I do. Even with the recent security breach, they are one of the best solutions for managing your documents and information across multiple platforms seamlessly.

However, like most companies, they don’t offer anything for Linux. Since I’ve used Wine to install the Windows version, I can report that it works perfectly. Just download the Windows Desktop version,  run it with Wine (which is available on almost any Linux distro), follow the instructions, and it just works.

Screenshot - 03282013 - 06:54:50 PM

A great article by Jamie Todd Rubin enlightened me to the possibility of using auto-fill programs to extend Evernote’s capabilities, and I have to say, it’s a pretty exciting idea I hadn’t thought of. Mr. Rubin of course doesn’t use Linux, so I had to improvise!

Ubuntu comes with a hotkey/autofill program called AutoKey, so I installed it from the Ubuntu repositories and gave it a shot… and it failed miserably. After fiddling with settings for a while, I got it to sort of work, but it still wouldn’t auto-type the shift key in Evernote. Worked okay in everything else, so I figured it was a problem with Wine.

I did some more poking on AutoKey’s site and discovered that this was a known bug with older versions of AutoKey, but had been fixed since version 0.80. Current version on their site is 0.90! And wonder of all wonders, the Ubuntu 12.04 repos had version 0.72?? Really?? (This isn’t an issue with Ubuntu 13.04, it has the latest version)

I downloaded the current version of AutoKey, and followed the instructions for creating a .deb package. When I went to install it, it prompted that it needed a package called python-pyinotify, so I installed that, tried again, and it finally worked.

I did a quick test of it in Evernote, and had success.

Now, once we’ve gotten it working, there’s the issue of creating auto-fill scripts to use in Evernote. With AutoKey, there’s two options: Phrases and Scripts. Phrases are basically text replacement; you can use any number of trigger keys or shortcuts for them.

If you want to get more into the powerful features of AutoKey, it supports the full-on Python scripting language. Which means, you can have it do any number of things on command, including running programs and manipulating windows! For our purposes, however, we will stick to basics, like grabbing the current date and time through a script.

Let’s say for instance, I want to create a script that creates an Evernote template every time I receive an important phone call. If I just want it to make a list, I can use a Phrase, but if I want to insert the date and time, we’ll need to use a simple Python script.

So we create a new blank Script, name it “Evernote Call” and set the shortcut to something I won’t accidentally type, like ;;call. Most of the script will just be outputting text, and we’ll use the function keyboard.send_keys(“”) to do it. Anything you put in the quotes will get typed by the keyboard. Special keys (like enter and tab) are done with brackets like so: <enter> or <tab>, respectively. We’ll start with a simple Header for the note:

keyboard.send_keys("Date and Time of Call:")

Then we want to insert the date and time. We can do this with a command, which just runs a program and returns the output. We have to declare it as a variable first, though, so now our script looks like this:

output = system.exec_command("date -R")
keyboard.send_keys("Date and Time of Call:")
keyboard.send_keys(output)

This types the output of the “date -R” command. You can use any switches for the date command, I prefer the -R switch’s format.

Once we’ve gotten that, the rest of the script can just be typed with the “keyboard.send_keys” function, like this:

output = system.exec_command("date -R")
keyboard.send_keys("Date and Time of Call:")
keyboard.send_keys(output)
keyboard.send_keys("<enter><enter>Phone Numbers:")
keyboard.send_keys("<enter><enter>Who am I Trying to Reach:")
keyboard.send_keys("<enter><enter>Reference Ticket #:")

It’ll look something like this:

Screenshot2 -

So there we go. Save the script, open Evernote, and open a new note. When we type the shortcut (in my case, ;;call) AutoKey replaces it with the text from the script, including inserting the date and time! You can also include things like Window Filters, which allows the script to only work with a certain program, and so on. It looks like this:

Screenshot3 -

 

If you wanted to get fancy, you could even script a way to fill in the Name and Tag fields with the <tab> output key!

Thanks to Jamie Todd Rubin for the idea!