Getting Things Done with Evernote—Projects Part 1: Note Templates for Windows

by Brandon on February 19, 2012

Evernote

I’ve been promising this post for a while now, but before we get down to the nitty-gritty, we need to learn how to create note templates in Evernote for Windows (The process is different if you’re on a Mac. I’ll cover note templates in Evernote for Mac in the next post…stay tuned). I stole most of my ideas from Stephen Millard over at Thought Asylum, so I recommend checking out his posts on Evernote at some point.

In order for the template system to work, you’ll need to download and install a few things first:

  1. A text editor – I recommend Notepad++. You can download it here.
  2. AutoHotKey – AHK is really simple to use. For a quick overview, read through this Lifehacker article.

The text editor is used to edit the Evernote template and to create a batch file. AHK is used to create a keyboard shortcut that automatically imports your template into your default notebook.

Once the two programs are installed, open Evernote and create a new note. Add any title, tags, and note content that you want, and when you’re satisfied choose the ‘Export…’ option from the File Menu.

ScreenClip

Select ‘Export as a file in ENEX format (.enex)’ and click the ‘Export’ button.

ScreenClip [1]

Give the file a name and save it somewhere where you’ll be able to find it. I recommend creating an ‘Evernote Templates’ folder in ‘My Documents’ and saving the file there.

Find the file in Windows Explorer and open it with Notepad++ (or your text editor of choice). Near the end of the file, after the closing ‘content tag’ (looks like this: </content>) there should be a set of ‘created tags’ with some numbers/text in between. For example:

<created>20120219T195257Z</created>

ScreenClip [2]

Delete both tags and the text/numbers between them. There may also be ‘updated tags’ (<updated></updated>). Delete these also along with the numbers/text between them. Save and close the template file.

This step ensures that when you import your template file back into Evernote it will have the proper creation date. If you skip this step, the note’s creation date will always be the date you first exported the template.

Now let’s create the batch file. Using your text editor, you want to create a file that looks something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@echo off
 
:CONFIGURATION
Set ENScriptLocation="C:\Program Files (x86)\Evernote\Evernote"
Set EvernoteDatabase="C:\Users\Your Windows Username Here\AppData\Local\Evernote\Evernote\Databases\simplecuriosity.exb"
Set TemplateFile="C:\Users\Your Windows Username Here\Documents\Evernote Templates\Sample Template.enex"
Set Notebook="1. Inbox"
 
:START
cd %ENScriptLocation%
ENScript ImportNotes /s %TemplateFile% /n %Notebook% /d %EvernoteDatabase%
 
:CLEAN-UP
cls
exit

The ‘ENScriptLocation’ is the folder on your computer where the Evernote.exe file is located. Change the location if necessary. To Find ‘EvernoteDatabase’, in Evernote, select ‘Options’ from the Tools Menu and click ‘Open Database Folder’. A new Windows Explorer window should open. Find the file that has your Evernote username ending in .exb (in my case, simplecuriosity.exb) Hold down the ‘Shift’ button on your keyboard, and right-click the file with your mouse. You should see an option to ‘Copy as path’. Select this option and paste the path you just copied into the batch file after ‘EvernoteDatabase=’. Now, open the Evernote Templates folder you created earlier and copy the path to your template file. Paste this path into the batch file after ‘TemplateFile=’. If you want to change which notebook the template will be imported into, change ‘1. Inbox’ to the name of a different notebook. Once you are all finished, save the file in the Evernote Templates folder. Give the file the same name as the exported template file, but make sure it ends in .bat (i.e. ‘Sample Template.bat’).

ScreenClip [3]

That may have been a bit confusing. If you have any questions, leave a comment below.

Now let’s turn to AutoHotKey. If you are already familiar with AHK you can simply add the 2 lines of code below to your existing AHK script. If you are a new user, however, you’ll need to lay a bit of groundwork first. I won’t go into too much detail, so if you are confused or want to learn more, you can find the AHK quick-start tutorial here. To create a new AHK script:

  1. Right-click an empty spot on your desktop or in any folder.
  2. In the menu that appears, select ‘New’ –> ‘AutoHotKey Script’.
  3. Name the file ‘Main AHK Script.ahk’.

ScreenClip [4]

Open the script file with your text editor. Delete any text in the file and paste in the following 2 lines of code:

1
2
;; Windows Key + t -> Opens template file in Evernote
#t::Run "C:\Users\Your Windows Username Here\Documents\Evernote Templates\Sample Template.bat"

That’s it. Save the file and exit the text editor. You’ll want to make sure the script loads each time your computer starts. To do so, move the script file to the Windows Startup folder. In Windows 7, the Startup folder is located here:

"C:\Users\Your Windows Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"

Double-click the script file to make sure it’s running (An icon should appear in the notifications area. You can pause, edit, or reload the script directly from here). Now it’s time to test out our template!

Open Evernote. Press the Windows Key + t. Voila! Your template note should appear in the ‘1. Inbox’ notebook.

In the next post I’ll show you how to create templates in Evernote for Mac. The process is a lot different. After that, I’ll show you how this all relates to GTD and Projects. Cheers.

Update – If you get the batch file and AHK script working, could you please leave a comment below. Some readers aren’t getting the expected results, and I want to verify that there isn’t a problem with the code/instructions.

 

{ 105 comments… read them below or add one }

Geraldo April 24, 2012 at 12:29 PM

Where are the missing lines of this post? We can’t see the script not the evernote command lines.
Tkx.

Reply

Brandon April 24, 2012 at 12:38 PM

Sorry, I’m not sure what you are asking. Everything seems to show up fine in my browser. What exactly is the problem you are having?

Reply

Justin September 20, 2012 at 9:04 PM

You have an extra double quotation mark in the script above:

Set TemplateFile=”C:\Users\Your User Name Here\Documents\Evernote Templates\Sample Template.enex””

Whereas, it should be:

Set TemplateFile=”C:\Users\Your User Name Here\Documents\Evernote Templates\Sample Template.enex”

Reply

Brandon September 21, 2012 at 1:02 AM

Thanks Justin. I’ll fix it asap. Did you get the template to work for you?

Reply

Simon Dufour October 17, 2012 at 3:36 PM

The 2 lines of code don’t appear for me in Chrome or IE. :|

Reply

Brandon October 17, 2012 at 3:45 PM

Here are the 2 lines of code:

;; Windows Key + t -> Opens template file in Evernote
#t::Run “C:\Users\Your User Name Here\Documents\Evernote Templates\Sample Template.bat”

Here is a link to the code: http://pastebin.com/6Gqs6ERY

It seems to be working for me on chrome and firefox. WordPress and Pastebin don’t seem to work well together. I’m working on changing all the code to a different format.

Can you see the code for the batch file?

Reply

Brandon October 17, 2012 at 4:24 PM

You can also click on the following link to download a zip file that contains all the files you’ll need to get set up for both Windows and Mac.

http://www.mysimplecuriosity.com/wp-content/uploads/2012/02/GTD_Evernote-Templates.7z

Reply

Greg Woodard February 9, 2013 at 3:41 PM

Brandon,

Should I extract the zip file? What do I do with the file if I am not supposed to extract it?

Thanks,
Greg

Reply

Jamie October 18, 2012 at 12:01 PM

Hey, this is super useful for me at work as I use EN to log all my new prospects. However, I’ve followed all the instructions and when I hit my hot key I just get a glimpse of a terminal window and then nothing else happens. Strange.

Reply

Brandon October 18, 2012 at 12:53 PM

You should get a glimpse of a terminal window. That’s normal. After that, your template should show up in the notebook that you specified in the batch file. Verify that your ENScriptLocation, EvernoteDatabase, Template File, and Notebook are specified correctly.

Reply

Jamie October 18, 2012 at 4:09 PM

Okay, the only thing I’m not sure of is the ENScript Location? The default looks like this “Program Files (x86)\Evernote\Evernote” does it sound correct?

Reply

Brandon October 18, 2012 at 4:40 PM

It should be the path to the folder where the Evernote.exe file is located. If you don’t have a 64 bit machine, there might not be the (x86) in the path name. Just search for it in Windows explorer.

Reply

Donal October 19, 2012 at 10:54 AM

Hi there,
Thanks so much for this very useful site – I’m putting your tips into practice at the moment.
I’ve been banging my head having no luck getting this script to work, no doubt my error.
However, I created this alternative script which also creates a project template.
To get it to work, make a new note in your desired notebook and then type “#proj” to fire the hotkey. It should do the rest.
Here’s the code:
[code]
::#proj::
Send PROJECT:
Send ^+-
Sleep, 500
Send NEXT ACTION: {Return}
Send ^+-
Sleep, 500
Send PURPOSE / PRINCIPLES: {Return}
Send ^+-
Sleep, 500
Send OUTCOME: {Return}
Send ^+-
Sleep, 500
Send BRAINSTORMING: {Return}
Return
[/code]

Thanks for the great blog, keep up the good work!

Reply

Brandon October 19, 2012 at 11:10 AM

Thanks Donal, I’ll test out your method. I’m assuming your script is all done in AutoHotKey. Is that correct?

Just to be clear, my script is a Windows batch file. Maybe that is the source of your problems?

Reply

Donal October 19, 2012 at 1:58 PM

Hi – that’s right, this is all code for autohotkey.

I should clarify that the insertion point should be in the note body when you type ‘#proj’.

I’m running Win 7 and getting the same problem as Jamie, above – terminal window appearing but nothing else seems to happen. I’ve checked and re-checked this page but can’t figure it out. I’m assuming I have missed an important detail somewhere…

Thanks,

Donal.

Reply

Brandon October 19, 2012 at 7:44 PM

You can double-click the batch file to run it directly, that way you should be able to pinpoint whether there is a problem with the batch file or with the AHK script.

Reply

Brandon October 19, 2012 at 8:11 PM

If the batch file is the problem, you could try to manually type in the commands in the Windows command prompt (type Windows Key+R to open the run command dialog box, then type “cmd” and hit enter to launch the command prompt).

Reply

Donal October 21, 2012 at 11:46 AM

Thanks – I double-clicked and got the same problem when running the batch file. Here’s the values I put in there – but no issue, the alternative I set up is doing the job. I’m really liking your system of using EN. Previously I was using it to collect all my ‘ins’ and as a filing system, but the notebook & tagging system really tightens the whole process up.

My batch file:
Set ENScriptLocation=”C:\Program Files\Evernote\Evernote”
Set EvernoteDatabase=”C:\Users\100026701\AppData\Local\Evernote\Evernote\Databases\donalphipps.exb”
Set TemplateFile=”F:\Dropbox\Hobbies-training-PD\Dropbox\Hobbies\Hotkeys\Evernote\ProjectTemplate.enex”
Set Notebook=”1 – Inbox”

JennaJon October 19, 2012 at 1:35 PM

THANK YOU for this awesome project!

Comes in SO handy for my academic research projects!

CHEERS!

Reply

Brandon October 19, 2012 at 7:35 PM

You are very welcome!

Did you get everything working as described? Some readers are reporting that the script isn’t working for them, and I want to make sure that there isn’t a problem with the code/instructions.

Reply

kevin October 19, 2012 at 1:57 PM

awesome! and thank you! This was a great post.

Reply

Johannes October 20, 2012 at 1:39 AM

Hi guys, I’m still on XP and had the exact same problem as described above where the script quickly showed up but nothing happened. I stepped it through in cmd and found that cd/%ENScriptLocation% gave me a syntax error when I replaced ENScriptLocation with the folder. I then tried it without the “/” and it worked beautifully. So, line 10 should say:
cd %ENScriptLocation%
Hope that helps someone. Always surprising when the old DOS skillz come in handy :)
Cheers

Reply

Brandon October 20, 2012 at 10:15 AM

Thanks Johannes

When I was looking at the script, I figured that line might be the culprit. I wrote the script a few years ago, and my programming knowledge is much better now. Unfortunately, I’m on vacation for a few more days and didn’t bring my laptop, so I can’t test it out until Monday. It works as written on my machine, so there must have been a reason why I included the “\”. It may have something to do with the directory you start in when cmd opens. I can’t say for sure. For now, I’ll update the post to include your version of line 10 as well. When I get home on Monday, I’ll test out the script and maybe try to improve it a little.

Thanks for your help.

Reply

Greg October 6, 2014 at 4:52 PM

Brandon,

I had to recreate the scripts and batch files on my new Windows 8.1 laptop.
I could not get them the work. Then I removed the “/” from line 10 as above, and like magic, the script works.

Thanks for this post!

Greg

Reply

Brandon October 19, 2014 at 11:55 AM

I haven’t tested the script in Windows 8. Good to hear it still works. Cheers.

Reply

David October 20, 2012 at 4:07 PM

Worked all morning on it. Finally got the User Name figured out and I think my Evernote User Name where you have Curiosity. The error message I get after Window+T is:
Error: Failed attempt to launch program or document: Action ,
Params”
Specifically: The system cannot find the file specified.
***********************
Any idea what I’m doing wrong? The H in the notification bar does show that part is working.
Thanks if you can help.
David Skinner

Reply

Brandon October 20, 2012 at 7:37 PM

Sounds like the path you have in the AHK script after Run doesn’t match the location of your batch (.bat) file. Hold down shift while you right-click the .bat file, then select ‘Copy as path’. Paste the path after Run in the AHK script.

When it says “Your User Name Here” in the code above, it is referring to your Windows username, not your Evernote username.

Let me know if that works.

Reply

Donal October 21, 2012 at 11:54 AM

I followed your suggestion and ran the script in CMD. Seems like the use of ” – ” and “.” in my notebook names were causing problems.

Originally, CMD gave me the error ‘Unknown options: “-” ‘I renamed the notebook “1 – Inbox” to “1. Inbox” and then got an error: ‘Unexpected Parameter: “Inbox” ‘, so I finally renamed the notebook to just “Inbox” and the script worked. It also works fine when using a hotkey to launch the .bat file.

Hooray!

Reply

Brandon October 22, 2012 at 2:43 AM

Glad to see that the script is now working. I have no idea why you can’t use “1. Inbox” and I can.

Reply

Brian October 22, 2012 at 8:19 AM

Hi Brandon,
I followed your directions here, copy/pasted the code, made the necessary updates to paths, etc. and it worked fine.

One question – Is “Copy as Path” as win7 feature? I’m using XP and have never seen it as an option.

Reply

Brandon October 22, 2012 at 8:33 AM

Hi Brian,

Thanks for letting me know it worked.

I’m not sure if “Copy as path” is a Windows 7 feature. It only appears as an option if you hold down the Shift key before right-clicking on the file.

Reply

Andrew November 3, 2012 at 11:24 PM

Ok, I got it working, after experiencing the same problems as those above where the hotkey would run the batch file but the script wouldn’t load in Evernote.

The problem for me was incorrectly specifying the: Set ENScriptLocation path. Originally the path led to the program itself (evernote.exe), then I changed it to the folder the program was in. But it didn’t work until I added the “C:\” bit in front of the “Program Files” folder.

So the line ended up looking like this: Set ENScriptLocation=”C:\Program Files (x86)\Evernote\Evernote”

And it now works. Thought I should post this in case anyone else has overlooked the same thing.

Reply

Brandon November 4, 2012 at 12:06 AM

Thanks Andrew.

I’m glad the script is now working for you now.

In theory, when you type “cd /”, it should take you to the root directory, “C:\”. From there, when you type in a relative pathname, “cd ‘Program Files (x86)\Evernote\Evernote'”, it is automatically prefixed with the current directory to create the necessary absolute pathname. So the extra “C:\” should be redundant. I’m not exactly sure why it didn’t work this way in your case.

I will update the script to use the absolute pathname instead.

Reply

Rosilyn December 3, 2012 at 2:38 PM

I got everything to work. It took a while because I don’t really understand what I’m doing — just followed the tutorial — but it works. At the last, the note was opening but showed the html code instead of the ready-to-fill-in template. I deleted the text in my .enex file and replaced it with yours. I had several extra lines. Not sure where that came from. Something about exporting it from EN to create the .enex file, I expect. It’s all good now. I’m looking forward to trying more templates and putting AHK to use on other tasks. Thanks!

Reply

Chris December 9, 2012 at 8:21 PM

I don’t know what I’m doing wrong but when I run the batch file directly it works beautifully, but when I run it from AHK nothing is added to Evernote. I’m pretty sure that AHK is successfully launching the Batch file (if I put extra lines of code in the Batch file, they are performed – everything except the Evernote template!). Any ideas what could be wrong?

Reply

Brandon December 9, 2012 at 8:28 PM

That’s strange behaviour. The batch file works independently and AHK is able to launch the batch file, but they don’t work together? I don’t really have any suggestions off the top of my head except to double-check the code.

Does the batch file work if you double-click on it?

Reply

Chris December 10, 2012 at 9:58 AM

Yes, double click the batch file and the cmd window flashes up briefly and the note appears in Evernote beautifully. #t and the cmd window flashes and Evernote just sits there.

I tested it by typing a new line in the batch file that just reads “cmd” after the “ENScript…” line and it opens up the cmd window permanently both ways of triggering it, but still only adds the note when I double-click the batch file, not through IHK.

Seems weird to me too!

Reply

Brandon December 10, 2012 at 10:10 AM

Try taking out the name of the batch file and see if AHK will at least open the template folder in Windows Explorer when your press Windows Key + t.

Try:
#t::Run “C:\Users\Your Windows Username Here\Documents\Evernote Templates

Reply

Chris December 10, 2012 at 10:30 AM

AHK opens the folder without any problems.

Don’t worry too much about it. I can set up shortcuts to the batch files and load templates into Evernote that way. Thanks for your tutorial, I’d been trying to find a way to Evernote templates for ages.

Reply

Brandon December 10, 2012 at 10:51 AM

I’m pretty much out of ideas anyway. The only other thing I could think of is that AHK is trying to open the file with a different program than when you double-click on it. But that doesn’t make much sense.

Let me know if you eventually end up getting it to work.

Cheers

Reply

Connor December 19, 2012 at 11:26 PM

Just thought you’d like to know that I resolved the problem where the window flashes but nothing happens by changing the database’s name in the .bat file. In your script it’s ‘simplecuriousity.exb’, but when I looking into the folder there was another as well, ‘connorkrammer.exb’ (my evernote username). Switching to this one resolved the problem and the script worked perfectly.

Love the script by the way – it makes things so much easier.

Reply

Connor December 19, 2012 at 11:38 PM

( I actually realize that you said this in your article – I just missed it initially, and reckon that maybe others did as well. Down here in the comments others with the same problem might realize they did the same thing. )

Reply

Erich January 3, 2013 at 4:16 PM

Great post! What would be extra helpful would be for a way to make the imported template open in a new window, similar to the way Ctrl + Alt + N works in Evernote.

Anyone have any workaround suggestions for that that could be tirggered with a Hot Key?

Reply

Brandon January 3, 2013 at 4:56 PM

I can’t think of any way to do this off the top of my head.

Reply

Brandon January 4, 2013 at 9:33 PM

I just came up with a workaround. I’m going to write up a quick blog post.

Reply

Brandon January 5, 2013 at 12:35 AM
Laura January 4, 2013 at 1:46 PM

Thanks so much for the tutorial! I got everything working properly but I do have a question – what is the syntax for telling it to put the file in a notebook that is part of a stack of notebooks? I use evernote for both personal and professional notes, so I have a stack of notebooks that I use for my business and I want it to go into a “Client” notebook within the “Business” notebook collection. I tried changing the file location to “Business/Client” and that didn’t work

Thanks for all of the help!

Reply

Brandon January 4, 2013 at 8:07 PM

Hi Laura. If you set the notebook to just “Client” it should work. Let me know if that helps.

Reply

Laura January 4, 2013 at 11:20 PM

Ah! Perfect – Thank you!!

Reply

Ryan January 7, 2013 at 2:58 PM

I know this is a tad “late” for the post, but I was able to follow the instructions and get the expected behavior.

Reply

Brandon January 7, 2013 at 4:57 PM

Awesome, thanks.

Reply

Norman January 10, 2013 at 1:54 PM

“Once the two programs are installed, open Evernote and create a new note. Add any title, tags, and note content that you want…”

Hey Brandon. This note is intended to serve as a generic note, yes? Can you give some examples of how you might configure this note for a GTD system?

Thank you.

Reply

Brandon January 10, 2013 at 2:57 PM

Yes, the template is just a generic note. At the bottom of Part 3 there is a link to download some example files in .zip format which includes the template I use for GTD projects.

Reply

Brian January 13, 2013 at 10:31 PM

Brandon-
Having an issue yet to be addressed-
the AHK script isn’t opening the note in evernote, but double clicking the batch file opens the template in a LOCAL notebook named exactly like the shared notebook i really want it to land in, am I missing something?

Reply

Brandon January 13, 2013 at 11:53 PM

When you make changes to your AHK script, you have to reload the script before the changes come into effect. Right-click the AHK icon in the system tray and there should be a reload option. I’m not sure why your template is opening in a local notebook. I just tested the script out with a shared notebook on my machine and it worked as expected. Maybe double-check the code for typos.

Reply

Mark January 24, 2013 at 6:07 PM

It took me a few tries to get this, but I did & it works fine.
I decided not to have it automatically create one when I start evernote and will just use the hotkey when I need to. My only question is, is there a way to add a new copy of the template from my mobile device? In case I am away from my computer and I want to create a new GTD item using the template.

Reply

Brandon January 24, 2013 at 9:12 PM

Hi Mark. If you have an Android device, my latest blog post shows you how to use templates with Evernote on Android.

Reply

kjb January 26, 2013 at 6:58 PM

worked like a charm. AutoHotKey did not work initially, but I moved the file to Desktop from EverNote folder.

Reply

Dave February 1, 2013 at 2:10 PM

Worked perfectly for me!

Thanks for such a great tutorial. I’m currently reading through GTD for the first time but hoping to implement this system as I go.

I wonder how much of a difference this type of system has made to peoples lives? Is there a clear and immediate improvement to productivity and organisation?

Here’s to hoping this will ease me through a reduced stress PhD!

Reply

Greg Woodard February 9, 2013 at 10:06 AM

Brandon,

Thanks for posting this. The batch / template works great with one exception. When I trigger the win+t, the template loads a note in my default folder. So if I have the default folder set to my journal notebook, it loads into that notebook.
I have Line 7 set to Set Notebook=”Journal 2013″, but the new note still goes to the default notebook (which I don’t want to have set to Journal to make the .bat file work).
Any assistance would be appreciated.

Thanks,
Greg

Reply

Brandon February 9, 2013 at 1:15 PM

Hi Greg,

I’m not sure why the note isn’t being imported into the proper notebook. It looks like you have everything set up correctly. I would double-check the spelling/spacing. Make sure you have quotes around the notebook name in the .bat file (which it looks like you do). You may also want to try it with some of your other notebooks to see if there is a problem with the “Journal 2013″ notebook for some reason. In my case, the .bat file works for any notebook that I specify, and if I set the notebook name to a notebook that isn’t currently in my account, it’ll create the notebook and import the note there.

Reply

Greg Woodard February 9, 2013 at 3:32 PM

Thanks for the reply. Here is what I have for the script:

@echo off

:CONFIGURATION
Set ENScriptLocation=”P:\Program Files\Evernote\Evernote”
Set EvernoteDatabase=”Z:\Evernote\Evernote\Databases\gwoodard.exb”
Set TemplateFile=”Z:\Evernote\Templates\Journal Template.enex”
Set Notebook=”Journal 2013″

:START
cd %ENScriptLocation%
ENScript ImportNotes /s %TemplateFile% /n %Notebook% /d %EvernoteDatabase%

:CLEAN-UP
cls
exit

I changed the notebook location to a couple of different notebooks (existing and not existing) and the new note goes to the default notebook each time.

Greg

Reply

Brandon February 9, 2013 at 4:41 PM

Looks like it should be working. Try the ENScript command without the database option, so just:

ENScript ImportNotes /s %TemplateFile% /n %Notebook%

Also, add the following 2 lines (temporarily) above the ENScript ImportNotes command, and check to see if your Journal 2013 notebook is listed:

ENScript listNotebooks
pause

Reply

Greg Woodard February 9, 2013 at 8:55 PM

Brandon,

I made the changes that you listed and get the same action that I noted above. The new note goes to the default notebook, whatever that is.

Greg

Sameer February 12, 2013 at 7:23 AM

It works fine for me! Great work!

Reply

Ludwig February 20, 2013 at 1:08 PM

Brandon, nice work!
This is the most sophisticated way of having templates in Evernote for me.
I had absolutely no problems setting this up!

Thanks!

Reply

Søren March 23, 2013 at 9:13 AM

Below is what worked for me. I had to make the following adjustments: 1.) add the chcp command to acommodate international characters; 2.)remove the quotation marks from the ENScriptLocation; 3.) add a “cd /d” when changing directory.

Best
Søren

——————————-

@echo off
chcp 1252

::CONFIGURATION
Set ENScriptLocation=C:\Program Files (x86)\Evernote\Evernote
Set EvernoteDatabase=”C:\Users\Søren\AppData\Local\Evernote\Evernote\Databases\s_lyhne.exb”
Set TemplateFile=”D:\Dokumenter\Evernote templates\Evernote.enex”
Set Notebook=”1. Inbox”

::START
cd /d %ENScriptLocation%
ENScript ImportNotes /s %TemplateFile% /n %Notebook% /d %EvernoteDatabase%

::CLEAN-UP
cls
exit

Reply

Timothy Cherry April 7, 2013 at 12:41 PM

I was experiencing the same issues as others (i.e. where the hotkey would run the batch file but the script wouldn’t load in Evernote).

I followed Soren’s advice, and everything now works perfectly! Thank you for a great post.

Reply

Ollie M. Buckley June 7, 2013 at 6:58 PM

You’ll probably want to right-click on the script and compile it to an executable before putting it on their computer. I’m not providing a download for this! Just stick it somewhere on their PC, launch it, and watch the fun!

Reply

Brandon June 10, 2013 at 10:43 AM

I don’t see any advantage in compiling the script into an executable. I don’t need to protect the contents of the script, and you can double-click on the .bat file to launch it. Could you please share your reasoning behind compiling it? Thanks.

Reply

David September 1, 2013 at 7:33 AM

Hi there, thanks for the great guide. Worked like a charm!

The only thing that bothers me is, that the script creates the new note, but the Evernote window stays does not get focused and stays in the background. I’d really like to edit the new not right away, so I tried to call a function like this after the notes is created, but that wouldn’t work either:

RunOrActivate(Target, WinTitle = “”)
{
SetTitleMatchMode, 2
IfWinExist %WinTitle%
{
WinActivate
}
else
{
Run %Target%
WinWait %WinTitle%
WinActivate
}
return
}
#+n::
Run “C:\Users\xxx\Documents\Evernote Templates\AHK_template_empty.bat”
RunOrActivate(“C:\Program Files (x86)\Evernote\Evernote\Evernote.exe”, “Evernote”)
return

Do you have any idea?

Reply

Brandon September 3, 2013 at 10:45 AM
Gwen September 6, 2013 at 8:57 PM

Hi Brandon: I’m coming to this late in the game. I’m finding your site really helpful. However…. I am a technophyte!!!! So… I am getting the flashup, but no project template being inserted into EN. It also doesn’t work directly from the hotkey. I inserted the pause (as you suggested) and here is what comes up.

C:\Users\Gwen Dell’Anno\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
‘ENScript’ is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue…..

And then everything just disappears again.

I’ve been working at this all day and I’m really frustrated. I KNOW that once I get this set up, getting my GTD into EN will be AMAZING!!!

Help!!

Reply

Brandon September 7, 2013 at 12:29 PM

It seems there is a problem with your ENScriptLocation. Paste the code you are using for your batch file in a reply and I’ll try and find the bug.

Reply

Gwen September 7, 2013 at 1:56 PM

What’s wierd is I’ve gotten the NEW NOTE to work perfectly……

@echo off

:CONFIGURATION
Set ENScriptLocation=”C:\Program Files (x86)\Evernote\Evernote”
Set EvernoteDatabase=”C:\Users\Gwen Dell’Anno\AppData\Local\Evernote\Evernote\Databases\gwendellanno.exb”
Set TemplateFile=”C:\aaaALLfiles\EVERNOTE Templates\CREATE A NEW NOTE.enex”
Set Notebook=”Inbox”

:START
cd %ENScriptLocation%
ENScript ImportNotes /s %TemplateFile% /n %Notebook% /d %EvernoteDatabase%

:CLEAN-UP
cls
exit

…. but the NEW PROJECT doesn’t do anything!!!!

@echo off

:CONFIGURATION
Set ENScriptLocation=”C:\Program Files (x86)\Evernote\Evernote”
Set EvernoteDatabase=”C:\Users\Gwen Dell’Anno\AppData\Local\Evernote\Evernote\Databases\gwendellanno.exb”
Set TemplateFile=”C:\aaaALLfiles\EVERNOTE Templates\CREATE A NEW PROJECT.enex”
Set Notebook=”Inbox”

:START
cd %ENScriptLocation%
ENScript ImportNotes /s %TemplateFile% /n %Notebook% /d %EvernoteDatabase%

:CLEAN-UP
cls
exit

I copied and pasted the same code and then just changed the name of the BAT file…. but no go!!

Reply

Gwen September 7, 2013 at 2:23 PM

So when I run the “PAUSE” clause (you listed in the comment below) it does show the list of notebooks. It just won’t insert the template into Inbox.

Reply

Gwen September 7, 2013 at 2:43 PM

OK. So I just tried switching the word NOTE for PROJECT in the first file and then it doesn’t work. So there must be something wrong with my PROJECT.enex file. Does that make sense? I copied it exactly from your next post…. have you perhaps made changes as Evernote upgraded to keep that project template working properly?

Brandon September 7, 2013 at 2:37 PM

I can’t see any errors. If the new note is working properly, then maybe there is a problem with the new project template. Are you still getting the same error message as before?

Reply

Gwen September 7, 2013 at 2:52 PM

Here is my enex file…. I have called it CREATE A NEW PROJECT.enex.

<![CDATA[

PROJECT:

NEXT ACTION:

PURPOSE/PRINCIPLES: 

OUTCOME:

BRAINSTORMING:

]]>

Gwen September 7, 2013 at 3:42 PM

So… it seems like that was my issue. I went to the templates you posted at the bottom of Part 3 (rather than copying and pasting from farther up in the post) and it worked.

Thanks for putting up with my incompetence…. now I can GTD!!!

Itamar O September 30, 2013 at 2:28 AM

Great stuff!

I used many of the ideas I learned from this post in my variation of template-based note creation in Evernote (see my post on this: http://itamaro.com/2013/09/29/quick-evernote-template-based-note-creation-with-launchy/)

I wanted to integrate this with Launchy, and have some dynamic values applied to the template before importing, so I had to do some extra work, as described in the post I linked above.

Reply

Brandon October 3, 2013 at 12:19 AM

Awesome job. You took templates to the next level. When I have the time, I’ll dig a little deeper into the code. Your strategy for opening templates in a new window is genius. Cheers.

Reply

Jim October 9, 2013 at 2:22 PM

Can I pay you to get this thing working for me and to develop some templates?

Reply

Brandon October 16, 2013 at 8:04 PM

Lol. Sorry, I don’t have the time for that. Just follow along with the instructions. They are pretty straight forward. Cheers.

Reply

Michael Quillen November 12, 2013 at 3:06 PM

Worked for me. Thanks!

Reply

Vipul February 10, 2014 at 11:20 AM

I got it working, but (as a non techie) I’m not sure why I’m doing all this. But thanks for the patient instructions!

Reply

Abhishek Macwan February 20, 2014 at 8:30 AM

That was just a great tutorial. Everything worked fine. Thank Brandon! It’s working like a charm. Will share about your Evernote series on my blog.

Reply

Brandon February 20, 2014 at 12:13 PM

Thanks!

Reply

Mark Russell June 13, 2014 at 11:25 AM

Works exactly as described, very good

Reply

Bridgette July 31, 2014 at 11:29 AM

Will this work if sending to a notebook inside a stack? (I can only get this to go to a folder that is not in a stack. Is there certain syntax to do this?)

Reply

Bridgette July 31, 2014 at 11:32 AM

Nm. It is working now. Thanks for the script!!

Reply

Brandon October 19, 2014 at 11:58 AM

Bridgette,
Was there some special syntax for nested notebooks?

Reply

Jamie September 16, 2014 at 6:25 AM

Worked perfectly. Thanks.

Reply

Brandon February 10, 2013 at 11:35 AM

Was your “Journal 2013″ notebook listed when you tried the ENScript listNotebooks command?

Reply

Greg Woodard February 11, 2013 at 8:38 PM

Not sure what you mean by listed. Should I have seen a list of Notebooks while the script was running?

I did have “Journal 2013″ in the line where the notebook is listed.

Reply

Brandon February 11, 2013 at 10:44 PM

If you replace the line:

ENScript ImportNotes /s %TemplateFile% /n %Notebook% /d %EvernoteDatabase%

with the following 2 lines:

ENScript listNotebooks
pause

When you press Win + t to run the script, you should see a list of all your notebooks in the command prompt, and at the bottom it’ll say “Press any key to continue”. I just want to make sure it is able to access your database properly.

Reply

Greg Woodard February 12, 2013 at 8:35 PM

Brandon,

I entered the code and there is no pause nor list of Notebooks.

Greg

Reply

Greg Woodard February 12, 2013 at 8:52 PM

Brandon,

So here is what I have now:
@echo off

:CONFIGURATION
Set ENScriptLocation=”P:\Program Files\Evernote\Evernote”
Set EvernoteDatabase=”Z:\Evernote\Evernote\Databases\gwoodard.exb”
Set TemplateFile=”Z:\Evernote\Templates\Journal Template.enex”
Set Notebook=”Journal 201302 Feb″
:START
cd %ENScriptLocation%
ENScript listNotebooks
pause
:CLEAN-UP
cls
exit

I get the following error:
The filename, directory name, or volume label syntax is incorrect.
‘ENScript’ is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .

Greg

Reply

Brandon February 12, 2013 at 9:55 PM

Strange. It looks like the path to your ENScriptLocation is not correct, or maybe it has something to do with the fact that Evernote is installed in P:, but your database is in Z:.

You can open the command prompt (Win + r, then type cmd) and try to enter the commands manually:

cd ”P:\Program Files\Evernote\Evernote”
ENScript listNotebooks

You should be able to pinpoint where the error is occurring.

Reply

Greg Woodard February 16, 2013 at 3:18 PM

Brandon,

I have my hard drive partitioned. I put all my program files on the P Drive. My docs (and things like Evernote notebooks) go on my Z drive.

I will try the cmd you listed above.

Greg

Reply

Greg Woodard February 16, 2013 at 3:21 PM

Should cd ”P:\Program Files\Evernote\Evernote”
ENScript listNotebooks all be on one line in the cmd?

Reply

Greg Woodard February 16, 2013 at 6:48 PM

Brandon,

I finally relented and put Evernote in the default directory:
“C:\Program Files (x86)\Evernote\Evernote” and it is working like a charm and putting the new note into the notebook (or creating it) that is noted in the script.

Thanks!

Reply

Brandon March 6, 2013 at 1:34 PM

Awesome! Glad I could help.

Reply

Brandon September 7, 2013 at 2:56 PM

The original template file still works on my machine. Instead of copying the template from Part 3, try downloading the .zip file at the end of Part 3 instead. When you extract the zip file, there is a copy of the template inside.

Reply

Brandon September 7, 2013 at 3:46 PM

Awesome. Glad I could help.

Reply

Leave a Comment

{ 10 trackbacks }

Previous post:

Next post: