我使用Autohotkey将alt + i / k映射到上/下键,使用以下代码:
!i:: Send {up}
!k:: Send {down}
这些重映射适用于除2016年Onenote之外的所有应用程序。我在线查看并在以下链接中找到了一些讨论:
https://autohotkey.com/board/topic/15307-up-and-down-hotkeys-not-working-for-onenote-2007/
https://autohotkey.com/board/topic/41454-remap-key-doesnt-work-in-ms-onenote/
他们建议使用sendplay或sendraw,但这些对我不起作用。谁能帮我这个?
SendPlay
并使用UI Access运行AHK脚本,则它可以正常工作这是你的Send
更改为SendPlay
的脚本:
!i::SendPlay {up}
!k::SendPlay {down}
它模仿你所期望的↑和↓。在Windows 10上使用OneNote 2016进行测试。
如何启用SendPlay
:(最初在Windows 10中无效)
updown.ahk
只有这两行。故障排除:
Installer.ahk
)就可以了,并选中该选项。 (无需卸载并重新安装。)SendPlay
仍然不起作用?
请参阅在线或在本地AHK帮助文件中提供的常见问题解答主题How do I work around problems caused by User Account Control (UAC)。 (他们是一样的。)
类似的主题也描述了限制是Run with UI Access(可在线或在本地帮助中获得)。似乎Autohotkey在OneNote上存在问题。做一些试验和错误我发现做:
Send {CTRL DOWN}{UP}{CTRL UP}
模拟向上键但不完全。
似乎很多人都遇到过OneNote的问题。
https://autohotkey.com/boards/viewtopic.php?f=5&t=25925
https://autohotkey.com/board/topic/49216-interference-between-microsoft-onenote-and-autohotkey/
但是,有些人建议在运行Onenote之前打开AHK可以解决这个问题。对于AHK与Onenote交互,Surface Pro用户似乎没有任何问题。我可以问你用的是什么电脑吗?
希望能帮助到你!
我的解决方案
if (winactive("ahk_exe onenote.exe"))
{
vk_code = 0xA0
dllcall("keybd_event","UChar", vk_code, "UChar", 0, "UInt", 0, "Ptr", 0 )
vk_code = 0x26
dllcall("keybd_event","UChar", vk_code, "UChar", 0, "UInt", 0, "Ptr", 0 )
vk_code = 0x26
dllcall("keybd_event","UChar", vk_code, "UChar", 0, "UInt", 0x0002, "Ptr", 0 )
vk_code = 0xA0
dllcall("keybd_event","UChar", vk_code, "UChar", 0, "UInt", 0x0002, "Ptr", 0 )
}
else
send {blind}{up}
!i::ControlSend, OneNote::DocumentCanvas1, {Up}, ahk_exe ONENOTE.EXE
发现在ahk论坛here (original)和here (citing original I think)。已经过验证,在Windows 10 1803上使用OneNote 2016(桌面版)。