Keeping a Daily Log in Evernote

For the last few years I have been keeping a daily log of events and information in a daily log using Evernote. In this article I will describe how I use a daily log in Evernote and the code I used to build a journal template.

Using a Daily Log

My daily log is a place where I record notes on programming, applications, machine, and other information. Updates to applications, error reports, meeting notes, code snippets, and links to articles I would like to read later are all kept in my log.

I record events by the date which gives some order to this jumble of information. Also when tracking errors down it is good to have a date associated with their appearance.Despite the dated entries I don’t really use it as a calendar or planner. However on occasion I will put an entry in a future date about some deadline or task to perform. But mostly it is for a record of what happened when on what project, program, or machine.

I keep one log per year. Although you can search over all your notes in Evernote I find it useful and faster to search within a note if I know the data or event was in a particular year. Also when you first bring up a note you are at January 1, so you have to page down to the current date to start a new entry for the current day.

Advantages of Evernote

Evernote is an online service for documents, images, web pages, and voice notes. Its greatest advantage is that your information is available via several means. The Evernote website has a sophisticated web application to view and edit your notes. There are applications available for Windows, Mac, iOS, and Android. The basic service is free and the paid service adds things like performing OCR on images and adding the words to the search index. There are also Chrome and Firefox add-ins that allow you to save a partial or entire page.

The majority of my Evernote usage is by the Windows application. The data is stored locally and synced with the website at an adjustable period. Notes are edited in a rich text editor that supports different fonts and colors, indents, bullet lists, and tables. Formatted data pasted in will retain the format of the original document.

Keeping the Log

When I started the log I kept a weekly template with horizontal rules to divide the daily entries and put a partial day/date at the top of each section. That meant every Monday morning I would have to copy this template, paste it into the end of the log, and then change seven strings like “2016.mm.dd Monday” to “2016.12.26 Monday”.

I got pretty tired of doing this and last year I started to investigate how to create a template that would suit my needs. Unfortunately paid programming work got in the way and I had to put the project aside. Also I found a 2016 calendar template on the Evernote site. I managed to edit this calendar into a usable log template. It had several drawbacks. The major one was that it was one big table so that limited how you could format things since one day was in one table cell. Also when you did an undo the document would zip back to the top, very frustrating after about April or May!

Creating a Template

This year I was determined to revive my custom template project and have a new template in place on January 1.

My original idea was to have a program create the date text and formatting data and save it into the Windows clipboard for easy pasting into Evernote. There is an Evernote XML export / import format (.enex) but I decided not to dig into that. Besides, how hard could it be to write formatted data to the clipboard? The application source is available here in Github.

Reading the Clipboard

First I created the function GetClipboardInfo to list the formats in the current clipboard entry and list the formats it contains.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

publicstatic StringBuilder GetClipbordInfo()

{

var sb = new StringBuilder();

var cbDataObj = Clipboard.GetDataObject();

if (cbDataObj == null)

{

return sb;

}

var fmts = cbDataObj.GetFormats();

sb.AppendLine("Data object formats: ");

foreach (var t in fmts)

{

sb.Append("\"");

sb.Append(t);

sb.AppendLine("\"");

}

After listing the formats I then check to see if an HTML Format object exists. If it exists we read it with the GetData function. The Replace function is to change the new line character to a carriage return / new line so the Winforms text control will display the line breaks.

1

2

3

4

5

6

7

8

9

10

// HTML Object

if (!cbDataObj.GetDataPresent("HTML Format"))

{

sb.AppendLine("No Html object");

}

else

{

var doc = cbDataObj.GetData("HTML Format");

sb.AppendLine(doc.ToString().Replace("\n", "\r\n"));

}

The “Version:0.9” is the beginning of the HTML Object followed by markers for the positions of the start / end of the actual HTML and the Fragment, which is what was copied. By copying parts of an Evernote note and using this tool I was able to determine what to put in the generated template.

The class GenEverLog has a single function CreateYear with a single parameter for the year to create. The HTML strings are divided between the sections before and after the date strings to be printed. The format strings are used for date formatting. These could be made variable with control settings added to the form. Also the hard coded colors in the HTML strings could likewise be made select-able.

From this point it is a simple matter to create a DateTime object, increment the day in a while loop, and build up a StringBuilder object with the HTML and the dates, months, and weeks. Note that a companion text only string is built up and will be sent to the clipboard. This text only string will be retrieved by applications that do not support HTML, such as Notepad.

To write the HTML to a new clipboard entry, I used the ClipboardHelper code from this article by Arthur Teplitzki. I had to clean up the code copied from the web page to change Word style double quotes to regular quotes and while I was at it I changed the style to use newer C# conventions. The only functional change I made was to remove the insertion of the Doctype line.

The “Write Everlog to Clipboard Function” button will call the CreateYear function and display “Added HTML to Clipboard”. If you want to see the HTML created, simply click the “Read Clipboard” button again.

If you are only interested in the template, the Fredwebs2017.enex file can be imported directly into Evernote. The file is included in the Github repository or download directly here.

About

I am a software developer living in Atlanta and occasionally writing about development, travel, electronics, and other related
items. Most of the code posted can be found at
Github. Leave a response to any post to contact me or message me at
Twitter.