Getting Things Done with Evernote—Projects Part 2: Note Templates for Mac

by Brandon on February 19, 2012

Evernote

In the last post I discussed how to create note templates in Evernote for Windows. Now let’s discuss how to do it on a Mac. Again, I want to give credit to Stephen Millard of Thought Asylum. Many of these ideas were taken from his blog, so I recommend reading his posts on the subject first.

The first step is the same as it was for Evernote for Windows. You need to create the note template and export it as a file in ENEX format (.enex) using the ‘Export Notes to Archive…’ option in the file menu. I recommend creating an ‘Evernote Templates’ folder inside your Documents folder and saving the template file there. Open the template file in your favourite text editor and delete the ‘created’ and ‘updated’ tags and all the numbers/text between those tags (see previous post for more details). Once that’s finished, save and close the template file.

Now it’s time to create an AppleScript. Open the AppleScript Editor and paste in the following code:

1
2
3
4
tell application "Evernote"
	activate
	import "/Users/Your OS X Username Here/Documents/Evernote Templates/Sample Template.enex" to "1. Inbox" with tags
end tell

You’ll need to change the path to the template file to match your needs, and, if you want, you can change the notebook into which the template file is imported as well. Once that is finished, create a folder named ‘Evernote’ in the following directory: /Library/Scripts. You’ll know you’re in the right directory if you see other folders such as ‘ColorSync’, ‘Folder Actions’, ‘iChat’, etc. there. Save the AppleScript in the /Library/Scripts/Evernote folder that you just created. Before you exit the AppleScript Editor, open ‘Preferences…’ and, under the ‘General’ tab,  make sure the ‘Show Script menu in menu bar’ option is checked. A little paper-scroll icon should now appear in your menu bar. Close the AppleScript Editor.

Now it’s time to test out the script. Click on the paper-scroll icon in the menu bar. Mouse over the Evernote folder and click on the note template script you just created. The note template should appear inside the notebook you specified.

If the script doesn’t seem to be working, put the template file directly inside your Documents folder and use the following code:

1
2
3
4
tell application "Evernote"
	activate
	import "/Users/Your OS X Username Here/Documents/Sample Template.enex" to "1. Inbox" with tags
end tell

You can create as many templates/scripts as you’d like, and you can launch them all directly from the menu bar.

Stay tuned for Part 3 where I’ll explain how to integrate the Evernote template system into your GTD workflow.

 

{ 20 comments… read them below or add one }

AW October 19, 2012 at 1:08 AM

For some reason, I can’t find the /Library/Scripts folder within my macbook. Any suggestions?

Reply

Brandon October 19, 2012 at 11:02 AM

Here are 2 ways to open the folder:

1. Launch Terminal, type open /Library/Scripts.

2. In Finder, type Shift+Command+G, then type /Library/Scripts in the pop-up window.

Let me know if that works.

Reply

Robert October 21, 2012 at 3:41 PM

When I try this I do not get a note as intended. I can see what I think is a dialog box flashing up but then it is gone almost instantly. When I run the script from the Applescript editor it shows the result of the script as being {}. I have no idea what that means.

Any thoughts?

-Rob

Reply

Brandon October 21, 2012 at 4:56 PM

I just tested the script (I don’t use a Mac regularly) and got the same result you did. It seems one of the Evernote updates broke the script. There is a problem with line 3. I’ll try to fix it and update the post.

Reply

Brandon October 22, 2012 at 2:58 AM

I just tested the script on an old Macbook running Snow Leopard (OS X 10.6.8), and it worked fine. Re-tested it on a newer Macbook Pro running Lion, and it didn’t work. I fooled around with the code a little bit. If I move the template file directly into the Documents folder (not in the Evernote Templates folder) and update the script to match, it seems to work on the newer Macbook Pro. Strange behaviour since they are both running the same version of Evernote. I’ll update the post and add an alternate version of the script.

Let me know if it works for you. Cheers.

Reply

Brian Binder October 26, 2012 at 12:57 PM

Brandon, you don’t have to publish this comment. Just wanted to say that your numbers are maybe swapped. If you are running Snow Leopard, I think you may have meant to put 10.6.8 and not 10.8.6. Thanks for the Evernote trick!

Reply

Brandon October 26, 2012 at 2:48 PM

Definitely a typo. I updated the comment. Thanks for noticing. Cheers.

Reply

bryan December 7, 2012 at 1:48 PM

Does not seem to work correctly with 10.8.2 and Evernote 5. If I already have the Notebook set up, it will not add templates to it.

Reply

Brandon December 7, 2012 at 7:41 PM

I haven’t tested it yet with Evernote 5. Hopefully over the holidays I’ll get a chance to look at it, and I’ll post a solution if I find one.

Reply

Royaljerry December 8, 2012 at 12:22 PM

For the ones who couldn’t make the script working: folks it seems, I have just found the solution. (OS X 10.7.5, Evernote 5.0.3.400675)

I have looked into the Evernote Library in AppleScript Editor → Window → Library and added the EN’s library. In the Evernote Suite set it is learly stated that the “import” command has two arguments: [to notebook] and [tags boolean], so I have modified the line in question to

import “/Path/to/My/Note/Template/Even/If/It/Is/Outside/of/Documents/Folder/My Template.enex” to “My Default Notebook” with tags

and restarted Evernote… et Voilà, the new note suddenly appeared in my notebook. Don’t forget the last “with tags” part!

A sidenote: actually I have written the line above as “… to “My Default Notebook” tags true” for the first try, that was straight away corrected to “…with tags” after saving the script. This is a bit annoyingly ambigous – I mean the command specification in the Library. (I mean _each_ command specification is ambigous, I just can’t understand why they don’t write a correct AS reference with examples, like Unix man pages, but nevermind.)

Reply

Brandon December 8, 2012 at 12:46 PM

Thanks for the comment Jerry. That’s actually how the script I use at home is written. It must have been a typo when I reformatted all the code on the site. I’ll update the script. Cheers.

Reply

Brandon December 8, 2012 at 12:50 PM
Royaljerry December 8, 2012 at 2:08 PM

Thanks.

“But Watson, for God’s sake, why can’t they publish all this scripting reference in the help file instead of hiding it from the users?” :)

Reply

Annie Mueller April 12, 2013 at 7:05 PM

I’m a little late to the conversation, just wanted to say thanks for putting this together. I used the method here to set up several different templates for blogging. Works like a charm. Saves me much time & frustration. Thanks!

Reply

Thomas Peddle April 19, 2013 at 6:22 PM

I found some comments by Evernote MAC developers discussing errors encountered with running Applescript. (http://discussion.evernote.com/topic/37015-applescript-fails-when-only-evernotehelper-is-running/)

I was running into issues with the tell “application” causing the import line to fail.

Change the first line of the Applescript from:
tell application “Evernote”
To:
tell application id “com.evernote.Evernote”
fixed the Applescript compile error for me.

I’m running Mac version 5.0.7 (400993) – Hope this helps!

Reply

Brandon April 19, 2013 at 7:42 PM

Awesome. Thanks!

Reply

RobW June 29, 2013 at 11:50 AM

Brandon –

Sorry, but I cannot get the script to create a note despite reading all the posts and trying everything suggested here. When I run the script, nothing happens in Evernote, and {} appears in the AppleScript Editor Result window. Evernote 5.1.4, OS X 10.8.4.

Any ideas?

Thanks,
Rob W

Reply

RobW July 1, 2013 at 8:29 AM

Update – I let it rest, and when I came back around today, it worked.

Reply

Tim Doubt December 11, 2013 at 9:07 PM

Same problem…..any hints?

Reply

Brandon December 11, 2013 at 11:08 PM

This post is fairly old. I’m not sure it still works with the newest version of Evernote. I just got a new MacBook Air, so I’ll test out the instructions on my machine and see if I can get it to work. Then, I’ll report back.

Reply

Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: