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:
- A text editor – I recommend Notepad++. You can download it here.
- 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.
Select ‘Export as a file in ENEX format (.enex)’ and click the ‘Export’ button.
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>
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’).
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:
- Right-click an empty spot on your desktop or in any folder.
- In the menu that appears, select ‘New’ –> ‘AutoHotKey Script’.
- Name the file ‘Main AHK Script.ahk’.
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.



{ 76 comments… read them below or add one }
Where are the missing lines of this post? We can’t see the script not the evernote command lines.
Tkx.
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?
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”
Thanks Justin. I’ll fix it asap. Did you get the template to work for you?
The 2 lines of code don’t appear for me in Chrome or IE.
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?
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
Brandon,
Should I extract the zip file? What do I do with the file if I am not supposed to extract it?
Thanks,
Greg
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.
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.
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?
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.
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!
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?
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.
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.
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).
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”
THANK YOU for this awesome project!
Comes in SO handy for my academic research projects!
CHEERS!
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.
awesome! and thank you! This was a great post.
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
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.
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
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.
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!
Glad to see that the script is now working. I have no idea why you can’t use “1. Inbox” and I can.
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.
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.
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.
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.
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!
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?
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?
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!
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
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.
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
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.
( 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. )
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?
I can’t think of any way to do this off the top of my head.
I just came up with a workaround. I’m going to write up a quick blog post.
http://www.mysimplecuriosity.com/how-to-open-evernote-note-templates-in-a-new-window/
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!
Hi Laura. If you set the notebook to just “Client” it should work. Let me know if that helps.
Ah! Perfect – Thank you!!
I know this is a tad “late” for the post, but I was able to follow the instructions and get the expected behavior.
Awesome, thanks.
“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.
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.
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?
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.
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.
Hi Mark. If you have an Android device, my latest blog post shows you how to use templates with Evernote on Android.
worked like a charm. AutoHotKey did not work initially, but I moved the file to Desktop from EverNote folder.
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!
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
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.
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
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
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
It works fine for me! Great work!
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!
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
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.
Was your “Journal 2013″ notebook listed when you tried the ENScript listNotebooks command?
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.
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.
Brandon,
I entered the code and there is no pause nor list of Notebooks.
Greg
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
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.
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
Should cd ”P:\Program Files\Evernote\Evernote”
ENScript listNotebooks all be on one line in the cmd?
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!
Awesome! Glad I could help.
{ 7 trackbacks }