Keyboard shortcut to change font colour on onenote 2013?

Solution 1:

In OneNote, if you can switch to desired color using sequence of keystrokes, then you can put these together into an AutoHotKey macro.

For example, in OneNote 2013 English, I am able to switch to red font color (with RGB value = 255,0,0) by sending:

Alt+h, f, c, m, Ctrl+PgDn, Alt+r, 2, 5, 5, Tab, 0, Tab, 0, Enter

So here you have few sample macros:

  • Ctrl+Alt+P=purple - picked from color swatches (resets color to Automatic before that)
  • Ctrl+Alt+R=red - by choosing More colors... and entering RGB values 255, 0, 0
  • Ctrl+Alt+B=blue - by choosing More colors... and entering RGB values 0, 0, 255
  • Ctrl+Alt+A=automatic - chooses Automatic color found on top of color swatches

The complete listing (use copy-paste):

; some helpful setup first
SetTitleMatchMode, RegEx ; match window titles by regular expressions

#IfWinActive - OneNote$ ; ------ only in windows with title ending with "- OneNote"

^!p::Send !hfca!hfc{Down 7}{Right 4}{Enter}
^!r::!hfcm^{PgDn}!r255{Tab}5{Tab}0{Enter} ; red (255, 0, 0)
^!b::!hfcm^{PgDn}!r0{Tab}5{Tab}255{Enter} ; blue (0, 0, 255)
^!a::!hfca ; automatic color (i.e. reset font color to "none")

#IfWinActive ; ------ end of section restricted to specific windows

Tested, works nicely!

This way, you can assign keyboard shortcut to almost any action in OneNote or other apps.

(If you are not familiar with regular expressions, you can simplify window title matching. See help for SetTitleMatchMode command. And omit $ from OneNote$.)

Solution 2:

this is my take for the same idea, but improved regarding the workings of OneNote, specially when it comes to the way the color window behaves, you can't switch on the fly the colors because it stays on the same tab.
Also, I added a matrix so you can easily modify the colors without mendling with an in-line number.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
; some helpful setup first
SetTitleMatchMode, RegEx ; match window titles by regular expressions

#IfWinActive - OneNote$ ; ------ only in windows with title ending with "- OneNote"
; change the number in "RGB :=" between  [#,#,#] using RGB colorspace 
{
    {
    ^!p::
        RGB := [167,21,157] ; purple
        Send !hfcm^{PgDn}!r
        Send % RGB[1]
        Send {Tab}
        Send % RGB[2]
        Send {Tab}
        Send % RGB[3]
        Send {Enter}{Right 1}
        GoSub, ^!a
    return
    }
    {
    ^!r::
        RGB := [255,0,0] ; Red
        Send !hfcm^{PgDn}!r
        Send % RGB[1]
        Send {Tab}
        Send % RGB[2]
        Send {Tab}
        Send % RGB[3]
        Send {Enter}{Right 1}
        GoSub, ^!a
    return
    }
    {
    ^!o:: 
        RGB := [235,110,26] ; Dark Orange
        Send !hfcm^{PgDn}!r
        Send % RGB[1]
        Send {Tab}
        Send % RGB[2]
        Send {Tab}
        Send % RGB[3]
        Send {Enter}{Right 1}
        GoSub, ^!a
    return
    }
    {
    ^!b::
        RGB := [0,0,255] ; Blue
        Send !hfcm^{PgDn}!r
        Send % RGB[1]
        Send {Tab}
        Send % RGB[2]
        Send {Tab}
        Send % RGB[3]
        Send {Enter}{Right 1}
        GoSub, ^!a
    return
    }
    {
    ^!c::
        RGB := [91,155,213] ; cyan
        Send !hfcm^{PgDn}!r
        Send % RGB[1]
        Send {Tab}
        Send % RGB[2]
        Send {Tab}
        Send % RGB[3]
        Send {Enter}{Right 1}
        GoSub, ^!a
    return
    }

^!a::Send !hfca ; automatic color (i.e. reset font color to "none")

; #IfWinActive ; ------ end of section restricted to specific window
}

Hope it comes handy for someone.

Solution 3:

I have the Swedish version of OneNote2016, so this is the "code" i used in AutoHotKey (since the keycommands are different than in the English version of OneNote). Kudos to miroxlav who gave me the initial lead in his answer, and I just adopted it for the Swedish version of Onenote2016

^!p::Send, !wfel^{PgDn}!r167!ö21!b157{Enter} ; purble (167, 21, 157)
^!r::Send, !wfel^{PgDn}!r255!ö0!b0{Enter} ; red (255, 0, 0)
^!b::Send, !wfel^{PgDn}!r0!ö0!b255{Enter} ; blue (0, 0, 255)
^!g::Send, !wfel^{PgDn}!r0!ö135!b0{Enter} ; green (0, 135, 0)
^!a::Send, !wfea ; automatic color

.. so what you try is to press "Alt" when in your note and see what letters appear to go into the menu where you change your color. If needed I could make a short video of how to do it. I's absolutely perfect now that it works!