1#Requires AutoHotkey v2.0
2OnError((exception, mode) => (FileAppend(exception.Message, "**"), ExitApp(1)))
3hwnd := WinExist("ahk_class Framework::CFrame ahk_exe ONENOTE.EXE")
4if !hwnd
5 throw Error("OneNote window is missing")
6WinActivate(hwnd)
7if !WinWaitActive(hwnd,, 5)
8 throw Error("OneNote window is not active")
9Send "{Left}"
10SendText "UI "