Automating OneNote with AutoHotKey to be a Journal

I use OneNote more and more in my daily work. I wanted to have the ability to make a journal function accessible from anywhere.

Goal :To be able to hit Win+J and have OneNote open the right page and date and time stamp the entry.

Outcome:

When I hit Win+J it opens OneNote at the right week (I have one page per week with the heading of Week 1, Week 2, …, Week 52) goes to the end of the entry and inserts a line and then makes a check box with the date and time as the value.

This allows me to simplify my weekly review as it is hard to miss a checkbox with a date in it.

I also created a second function Ctrl+Shift+Alt+Win+J which makes 52 pages in OneNote (You need to have the section open that you want the pages created in) for the journal.

Configuration:

You will need to modify the OneNote Url in the code.

; Set the path below to the section containing the week pages and ensure it ends with #Week%20
OneNoteUrl := “onenote:< PATH TO SECTION CALLED 2011 Journal >/2011%20Journal.one#Week%20

Code:

[code lang=”autohotkey”]
; Goes to the week in OneNote for the journal.
; Created by Jon Bullen (<a href="http://40.91.120.192)">http://40.91.120.192)</a>
; Leave a comment on the site if you have issues.

#SingleInstance force
#NoTrayIcon

#j::
; Set the path below to the section containing the week pages and ensure it ends with #Week%20
OneNoteUrl := "onenote:&lt; PATH TO SECTION CALLED 2011 Journal &gt;/2011%20Journal.one#Week%20"

StringRight, WeekNumber, A_YWeek, 2
StringReplace, WeekNumber, WeekNumber, 0, ,All
; Hack to match Outlook… Works for 2011…
WeekNumber := WeekNumber + 1

Run, %OneNoteUrl%%WeekNumber%

WinWaitActive, Week %WeekNumber% – Microsoft OneNote
Sleep, 500
SendInput, ^{End}
SendInput, ^{End}
SendInput, {Enter}{Enter}
SendInput, ———————————————–
Sleep, 500
SendInput, {Enter}
SendInput, ^1
SendInput, !+D
SendInput, {Space}
SendInput, !+T
SendInput, {Enter}

return

; Create all the weeks in the year in the current section.
#+!^j::

Loop, 52
{
SendInput, ^n
SendInput, Week %A_Index%
Sleep, 100
}

return
[/code]

Sytone

I’m a principal engineer working at Microsoft. I have run and supported services for over twenty years and worked in multiple countries. I love working with passionate people and new technology.

Comments

  1. Hi there, I’ve tried to use the code you’ve provided, however it doesn’t work as expected for me. I can use the #j:: command to launch Onenote at the correct section, however this only works once, and I have to reload the script in order for it to work again. Also, the key to automatically create the weeks doesn’t work at all. I have no error log to look at so I can’t debug the situation. Do you have any tips I could follow to get me on my way? 

    Many thanks,
    Richard 

  2. Here’s a copy of the error I am getting. It looks as if it encodes the URL twice? BTW, I’m using Windows 7..

  3. Looks like you left a bracket in the URL. Try the URL below to see if it works.

    OneNoteUrl := “C:UsersRichard.FortuneDocumentsMy%20DropboxOneNote%20NotebooksPersonal%20Notebook2011%20Journal.one#Week%20”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.