Search
« Power Mailing to Evernote | Main | ReaddleDocs Bookmarklet »
Monday
Mar152010

Creating a Daily Journal in Evernote

Building on yesterday's post on an improved template system for Evernote I'd like to share with you how I use a variation on this system to create a daily journal template.

Several years ago I got fed up with getting to the end of a day and wondering where my day had gone and what I'd really achieved.   Ticked off to-do lists only ever told a fraction of the story so I began to keep a daily journal.  This has taken a variety of forms but now it lives in Evernote.  Each day as I do things I log it.  Five seconds logging anything from phone calls and e-mails to issues resolved and meetings attended.  This lets me keep track of things from a day to day point of view (making me feel better about what I've achieved) and it also helps me pull together reports on what I and my team have been doing or even for my formal reviews.  Journalling in Evernote keeps everything at my fingertips.

From that you can probably guess that I really like to have things just so.  This includes the format of my journal.  So that I can keep things up to date on my iPod touch and my PC I simply have one row per item (I gave up on bullet points as the iPod doesn't support editing these (yet)).  I have the note tagged as "Journal" and currently I keep it in an Evernote notebook also called "Journal".  So this all seems pretty straight forward and could easily be accomplished using the system described in my earlier post.  The issue for me is that the title of each note is the date it is the journal for.

Sometimes I might create several days journals on the same day retrospectively (e.g. after being off ill or on a course) and so having the date in the title is really helpful in sorting as the creation and modified dates don't necessarily relate to the date of the activities.  I also have the date in the format "yyyy-mm-dd" to support the option to sort.

So this means that in order to create a template to create a journal note for 'today', it would need to introduce some dynamically generated content in the form of the date.

For any keen scripters out there, the answer and principles are probably quite obvious and you could effectively write a script to dynamically populate the note with information in any number of ways.  Since this is just dealing with the current date I was actually able to just get away with a few DOS commands in a batch file as shown below.

@echo off

REM Initialise
set ENscriptLocation="C:\Data\Applications\Evernote 3.5\ENScript.exe"
set EvernoteDatabaseLocation="C:\Data\Evernote Data\Databases\evernotedatabase.exb"
set FilePart1="C:\Data\Evernote Script\journal part 1.txt"
set FilePart2="C:\Data\Evernote Script\journal part 2.txt"
set WorkingFile="C:\Data\Evernote Script\journal.enex"
set JournalNotebook="Journal"

REM Build template to import
type %FilePart1% > %WorkingFile%
echo %date:~6,4%-%date:~3,2%-%date:~0,2% >> %WorkingFile%
type %FilePart2% >> %WorkingFile%

REM Create the journal from the template
%ENscriptLocation% importNotes /s %WorkingFile% /n %JournalNotebook% /d %EvernoteDatabaseLocation%

REM Clear up and close
del %WorkingFile%
set ENscriptLocation=
set EvernoteDatabaseLocation=
set JournalNotebook=
set FilePart1=
set FilePart2=
set WorkingFile=
cls
cls
exit
The script is relatively straight forward.  It begins by setting several variables which indicate where to files - the ENSCRIPT executable and the Evernote database.  This is followed by the location of three further files.

The first two of these are the static parts of the note - in this case the first file contains everything before the note's title and the second everything after the note's title.  The content of these two files can be seen below.  The third file is just a file used temporarily to build the note to be imported into Evernote.

The last variable is simply the name of the notebook I want the Journal note to appear in.

With the variables set the next section concatenates the pre-title note content with the date in the desired format and the post-title note content.  These are all output into the file to be imported.

The next step is the actual import of the generated note into Evernote and once that has been done, the script removes the generated note file, clears out the variables and closes.

In case you are wondering what the content of the pre-title and post-title files are, the contents are shown below.

Pre-title File
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export.dtd">
<en-export export-date="20090314T120030Z" application="Evernote/Windows" version="3.5">
<note><title>
Post-title File
</title><content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml.dtd">

<en-note></en-note>]]></content><tag>Journal</tag></note></en-export>
I find this script much quicker to run than creating the new note in the right notebook, typing in the date (after trying to recall what it is) and then adding the tag.  I simply trigger it from PS menu (see previous article) and that's it done.

The one thing it's missing for me is automatically selecting the note in Evernote.  It's something I can live with for now because it's still a little quicker for me than creating it myself, but until a fully integrated template system becomes available in Evernote I think this is about as good as I'm going to get it.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (11)

Great post.

ENscript has a showNotes function that can be used to show the note in Evernote after it is created. I have modified your script to display the note after it has been created.

@echo off

REM Initialise
set ENscriptLocation="C:\Program Files\Evernote\Evernote3.5\ENScript.exe"
set EnUser=someuser
set EvernoteDatabaseLocation="C:\1data\Evernote\Data\Databases\%EnUser%.exb"
set FilePart1="C:\1Data\Evernote\ENscripts\journalPart1.txt"
set FilePart2="C:\1Data\Evernote\ENscripts\journalPart2.txt"
set WorkingFile="C:\1Data\Evernote\ENscripts\journal.enex"
set Notebook=Journal
set Title=%date:~10,4%-%date:~4,2%-%date:~7,2% %Notebook%


REM Build template to import
type %FilePart1% > %WorkingFile%
echo %title% >> %WorkingFile%
type %FilePart2% >> %WorkingFile%

REM Create the journal from the template and show the note in Evernote
%ENscriptLocation% importNotes /s %WorkingFile% /n "%Notebook%" /d %EvernoteDatabaseLocation%
%ENscriptLocation% showNotes /q "%Title%" /u "%EnUser%" /d %EvernoteDatabaseLocation%

REM Clear up and close
del %WorkingFile%
set ENscriptLocation=
set EvernoteDatabaseLocation=
set JournalNotebook=
set FilePart1=
set FilePart2=
set WorkingFile=
set title=
cls
cls
exit

I added the name of the Notebook to the title to distinguish it from notes that might be named by date as well. Hope this helps.
Paul

July 8, 2010 | Unregistered CommenterPaul Cartwright

Great post. I have adapted this to take user entered input for project names to appear in the note and note title and add windows user names to the author field.

One problem I'm having is that using the echo SomeText >> SomeFile adds a carrige return to the result breaking the file and causing Evernote not to sync.

What I need is <type1><echo1><type2> but what I'm getting is
<type1><echo1>
<type2>

Any hints or did you come across this?

Thanks for all your work on this template system though!

Sm.

July 8, 2010 | Unregistered CommenterSam Brown

Nice one Paul. I was looking at something similar for this, but hadn't actually got around to trying it. Currently I've found that if I'm in my "journal" notebook and call the journal creation script, I have to duck out of the notebook and back in again to "reveal" the new journal note. I don't know if you've noticed this behaviour. Notably this doesn't happen on my Mac.

I have some leave coming up and had planned to look into this a bit more, but maybe now I won't have to :)

July 8, 2010 | Registered CommenterStephen Millard

Sam.

I haven't had this issue, but my first thought is that maybe whatever method you're using to get user input is inadvertently adding the CR in. There are clever things you can do to manipulate strings in batch files, but this is not great.

Maybe this will help?

I popped the following in a BAT file:

echo #FOO# >> test.txt
set INPUT=
set /P INPUT=Type input: %=%
echo ***%INPUT%*** >> test.txt
echo #BAR# >> test.txt

When I ran this I entered Hello World for my input. The resulting test.txt was as follows:

#FOO#
***Hello World***
#BAR#

So if you write / append the title with the tags in one line of script using this method you should be okay. Any append to the file will add a CR/LF. This is just a guess as to what might be going on. If this doesn't solve your issue feel free to e-mail me your script and I'll see if I can work out what's going on and how to fix it.

July 8, 2010 | Registered CommenterStephen Millard

Thanks for your reply Stephen your suggestion worked and the script is running well now. As an aside on further investigation it was not breaking the title tag causing the problem but was only when I broke the tags in the footer of the of the template it caused problems. and <tag>.

Thanks again for all your work on this — I now have a script which gets user input for title and creates a new note with date, title, author (from the windows %USERNAME%), and also creates a matching project folder on the network. Things should get a lot smoother here now!

July 14, 2010 | Unregistered CommenterSam Brown

Sam. Great to hear it all worked out for you. As a slight aside depending upon your login IDs/user names and your particular set-up, in many organisation's logon scripts can set variables to a real/display name at login. Alternatively you can sometimes read information from a central security system (e.g. Active Directory) with the right command line tool. But at the end of the day all you *really* need is a meaningful identifier for the author.

July 14, 2010 | Registered CommenterStephen Millard

Hi, great script ! I'm using it with a tiny modification in the showNotes options to be more specific :

%ENscriptLocation% showNotes /q "intitle:%Title%

December 29, 2011 | Unregistered Commenterpylm

This is great, but I don't know much about scripting, programming, batch files, etc. Where do i start to implement this and can i copy and paste into an application on my mac?

March 7, 2012 | Unregistered CommenterCimon

Cimon.

First off the solution presented here is for Windows not for Mac OS X. So unless you are running Parallels, Fusion, BootCamp, VirtualBox or something along those lines you'll need an alternate solution. Fortunately I'm also a Mac user and have a blog post for how to set it up on a Mac.

For the Mac you'll probably be using an application called AppleScript Editor. But for anyone who might be pondering this Windows version...

The first chunk of script/text should be saved in a .BAT file (batch command) - you can do this from a text editor such as Notepad. The other two files can also be saved as .TXT files (text) which you can again do from notepad.

Please note that you will almost certainly need to modify some of the file paths specified in the BAT file.

Hopefully that goes some way towards answering your question.

March 8, 2012 | Registered CommenterStephen Millard

Help!! I've just started using Evernote and found this website when I googled for answers. I too would like to have a journal set up but I know nothing about DOS and programming. I have a Windows XP setup. Is there an easy answer for me to have this ability? Or will I need to wait until Evernote make their own changes? Also, I tried to change the Notebook color but my machine says it doesn't know what the extension is. How nice it would be to understand the gobbldeegook you guys use on your messages.

April 11, 2012 | Unregistered CommenterDinosaur

Dinosaur.

By default Windows doesn't know how to open .ENEX files (Evernote note archives). You can import them into Evernote by selecting them from within Evernote using the menus: File > Import > Evernote Export Files... (then just select your file). ALternately I wrote a post on how to set up an association between .ENEX files and Evernote so that when you double click on them the automatically open in evernote - set an Evenote template file in ENEX format to open in Evernote

As for DOS and programming, you shouldn't need to know much. A little bit never hurts and if you are interested maybe something like http://www.ericphelps.com/batch/ would be a good starting point. However I do try and write my posts as far as possible in step by step instructions (with a bit of extra info for those who might know more) to achieve the goal. If there's something in particular in a post where it is unclear what to do or how I got to that point, post a comment with what you want help with (just like the - it doesn't open with Windows) and I or a fellow reader will do our very best to help.

This post for example has the batch script set out so that you can more or less copy & paste it into your favourite text editor (then amend the destination notebook as necessary. i can see that if you have never used batch files how you might get stuck on how to create one at this point. So just in case ... open the Notepad application that comes as standard with Windows. Copy and paste the script into it and amend as per the instructions above. Now save the file (File > Save) and name it something meaningful with a file extension of ".bat" e.g. "import-template.bat". Close notepad, find the .bat file you created in Windows explorer (it may even be on your desktop), and double click it to run it.

So as I say if there's something in particular that your struggling with just let us know. Everyone has to start somewhere and often not knowing where to start is the biggest hurdle -I'm happy to try and help you over it if I can.

Stephen.

April 17, 2012 | Registered CommenterStephen Millard

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>