I’m a U.S. English user, and I don’t have OneNote (and I’ve never used it),
so my contribution may not be valuable to you.
But many programs — including most Microsoft programs,
or at least most Microsoft Office programs,
or at least most Microsoft programs that have a ribbon
— have a way of navigating the ribbon
to get to the functions quickly using the keyboard.
This capability implies a set of keyboard shortcuts
that are hidden in plain sight.
For example, in Word, if I press Alt
(and either release it, or hold it for a second), I get this:
Note that the ribbon tabs are labeled with letters:
- F = File
- H = Home
- N = Insert
- G = Design
- P = Page Layout
- ⋮
and the buttons on the Quick Access Toolbar (Save, Undo, Redo, …)
are labeled with numerals.
If I press N, for INSERT, I get this
Note this detail from the right end:
So, in U.S. English Microsoft Word, Alt, N, E
is a hidden keyboard shortcut for Insert Equation.
You can type this any of the following ways:
- Press and release Alt, press and release N,
press and release E
- Press and hold Alt, press and release N,
release Alt, press and release E, or
- Press and hold Alt, press and release N,
press and release E, release Alt
and, once you have released the Alt key,
you can use Shift, or not, as you prefer. So you can
- Press and release Alt, then type
n
and e
- Press and release Alt, then type
n
and E
- Press and release Alt, then type
N
and e
- Press and release Alt, then type
N
and E
- etc.
So experiment with Alt in your version of OneNote
and see what you find. (As noted, OneNote is different from Word,
and these shortcuts may be language-dependent.)
Another approach is to add Insert Equation to the Quick Access Toolbar.
Then you will be able to use Alt+4, or whatever,
depending on how many other items you have in your Quick Access Toolbar.
Best Answer
Using AutoHotkey:
If you don't want to use
+
and-
keys on a numerical keyboard replaceNumpadAdd
with=
andNumpadSub
with-
(assuming you have anEN
keyboard layout and want to use the keys next to backspace).The
^
stands forCtrl
,+
forShift
and!
would stand forAlt
if you want to modify the hotkeys (more info on special modifiers).Complex explanation
I'm a bit of an AutoHotkey nerd, because I encounter these types of issues often in my own workflow and couldn't help myself not to explain how the language works here. In case anybody wants to delve into the deep waters, here you go:
The < > and + key problem:
For me the
<
and>
keys normally act (without the Shift and Control) as a dot.
and comma,
and+
acts as=
, and that is also the proper way to write them into the script. Another possible reason for why a version of the script with these keys wouldn't trigger is because the<
,>
and+
are special modifier symbols. In case normal key names don't work at all, there are also special virtual key IDs{vk##}
and scan codes{sc##}
which can be used instead and figured out using KeyHistory. There is a bit more complexity and preparation to this last part, example here.The window detection:
Additionally a better way to approach the window title in
WinActive
in this case may be to refer to the .exe directly usingahk_exe [app_name_goes_here].exe
. Name of the OneNote executable may differ in other editions (I'm using OneNote 2016). You can figure it out usingWindowSpy.ahk
(which is an app that should be a part of every AutoHotkey installation (you will find it in the AutoHotkey folder)) or by looking for the OneNote executable in the task manager.Proper use of WinActive in this case:
In order to not disrupt the new hotkey combination (
^NumpadAdd
+^NumpadSub
) added using the script in other apps it's important to make them context-sensitive using#If
, which has to be positioned above these hotkey declarations. If you want to expand the script with non-context-sensitive code underneath, it's important to turn the context-sensitivity off using an empty#If
statement.One-line hotkeys and no need for Send/SendInput:
If the hotkey is simple enough that it fits into one line, it doesn't need to return and doesn't even need to use
Send
orSendInput
. This can however prove tricky if you need to use specially named keys such asNumpadAdd
which would inSend
be written with{}
around them. (exampleSend {NumpadAdd}
)