One of our internal OneNote users wanted a desktop shortcut to automatically open a specific page in OneNote. He keeps all his active "To Do" items on that page and wanted to quickly open that particular page. I pointed him at my batch file/Windows Task Service to do this and then Konstantine replied with an AutoHotKey script to perform a similar function. Here's what he had to say:

----

I’m a keyboard shortcut junkie so one more thing I did was to assign it to a keyboard shortcut. Some MS Keyboards have a bank of numbered buttons (above the Function Keys) that can be programmed to execute applications. Button #1 opens my tasks.

If you don’t have that kind of keyboard, you can also assign keyboard shortcuts to links on the desktop or create something in AutoHotkey.

Here is what I did with autohotkey

This script will:

  1. Launch onenote on Win+n, Win+n
  2. Launch todo Win+n, Win+t
  3. Launch my projects on Win+n, Win+p

Very convenient indeed…

*#n::
    If winNPrefix = 1
    {
        IfWinNotExist, ahk_class Framework::CFrame
        {
            Run, onenote
        }
        else
        {
            ToggleRestoreMinimize("ahk_class Framework::CFrame")
        }
        winNPrefix = 0
    }
    Else
    {
        winNPrefix = 1
    }
return

; -------------------------------------------------------------
; Onenote command handler for Win+n, Win+t
; -------------------------------------------------------------

*#t::
    If winNPrefix = 1
    {
        Run, onenote /hyperlink onenote:///https://******.docs.live.net/************/myOnenotes/Todo.one#To-Do&section-id={4243287F-E341-42B6-439C-72ACB33C10E0}&page-id={D4A34CFB-B69D-4B3F-B6B6-DE3DC6070E5C}&end
        winNPrefix = 0
    }
return
; ----------------------------------------------------------
; Restores or minimizes a window
; ----------------------------------------------------------
ToggleRestoreMinimize(in_winTitle)
{
                WinGet mnmx, MinMax, %in_winTitle%
                if (mnmx = -1)
                {
                                ; window is minimized restore it
                                PostMessage, 0x112, 0xF120,,, %in_winTitle%
                                WinActivate %in_winTitle%
                }
                else if (mnmx = 0 || mnmx = 1)
                {
                                IfWinNotActive %in_winTitle%
                                {
                                                WinActivate %in_winTitle%
                                }
                                Else
                                {
                                                PostMessage, 0x112, 0xF020,,, %in_winTitle%
                                }
                }
}

Pretty slick. I'm a big fan of AHK since it makes so many repetitive that much easier.  Oh, and to get the URL Konstantine uses, see my original article.

Thanks for letting me post this, Konstantine!

Questions, comments, concerns and criticisms always welcome,

John