Automating OneNote with AutoHotKey to be a Journal

Posted by Jon Bullen on 2011-01-18
Estimated Reading Time 1 Minutes
Words 200 In Total

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
; Goes to the week in OneNote for the journal.
; Created by Jon Bullen (http://blog.sytone.com)
; 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

If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you!