JS1025
JS1025

Reputation: 1

onenote 2016 - Change pen color using numberpad

I found a couple scripts online that change to one color and tried to add multiple numbers to allow them to change the color. I want to eb able to use an external keypad to change to a specific color in onenote.

Code below

#Requires AutoHotkey v2.0

SetTitleMatchMode , 2
SetKeyDelay , 75
#If WinActive("OneNote")
Numpad1::SendEvent , !d{down}{right 4}{enter} ; change to black pen
Numpad2::SendEvent , !d{down}{right 5}{enter} ; change to red pen
Numpad3::SendEvent , !d{down}{right 6}{enter} ; change to blue pen
Numpad4::SendEvent , !d{down}{right 7}{enter} ; change to green pen
Numpad5::SendEvent , !d{down}{right 8}{enter}; change to blue highlighter
Numpad6::SendEvent , !d{down}{right 9}{enter}; change to red highlighter
Numpad7::SendEvent , !d{down}{right 9}{enter}; change to blue highlighter
#If

This is my code, but so far nothing happens. I can change to the color manually but none of the hotkeys work.

Also, do I need my keyboard with numlock off for this to work?

Upvotes: 0

Views: 198

Answers (1)

JS1025
JS1025

Reputation: 1

#IfWinActive ahk_exe ONENOTE.EXE
F1::SendEvent , !d{down}{right 4}{enter} ; change to black pen
F2::SendEvent , !d{down}{right 5}{enter} ; change to red pen
F3::SendEvent , !d{down}{right 6}{enter} ; change to blue pen
F4::SendEvent , !d{down}{right 7}{enter} ; change to green pen
F5::SendEvent , !d{down}{right 8}{enter} ; change to blue highlighter
F6::SendEvent , !d{down}{right 9}{enter} ; change to red highlighter
F7::SendEvent , !d{down}{right 10}{enter} ; change to purple highlighter
#IfWinActive

I changed the code to the above and it works.

Upvotes: 0

Related Questions