Up / Down键无法在Onenote 2016中用于Autohotkey

问题描述 投票:12回答:5

我使用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,但这些对我不起作用。谁能帮我这个?

autohotkey onenote
5个回答
5
投票

如果您使用SendPlay并使用UI Access运行AHK脚本,则它可以正常工作

这是你的Send更改为SendPlay的脚本:

!i::SendPlay {up}
!k::SendPlay {down}

它模仿你所期望的↑和↓。在Windows 10上使用OneNote 2016进行测试。

如何启用SendPlay :(最初在Windows 10中无效)

  1. 将上述映射保存到AHK文件中。我使用文件updown.ahk只有这两行。
  2. 右键单击上面的AHK文件,然后从其上下文菜单中选择Run with UI Access(这实际上可以解决)

故障排除:

  • AHK文件的上下文菜单中缺少“使用UI访问运行”项 确保使用安装程序将AutoHotKey安装到Program Files目录中。 AutoHotKey文档说UIA仅在文件位于受信任位置(即Program Files子目录)时才有效。 在安装程序选项中,请务必检查最后一项,如下所示。 enter image description here 提示:如果已经安装了AutoHotKey,只需重新运行安装程序(在AutoHotKey可执行文件的位置找到Installer.ahk)就可以了,并选中该选项。 (无需卸载并重新安装。)
  • SendPlay仍然不起作用? 请参阅在线或在本地AHK帮助文件中提供的常见问题解答主题How do I work around problems caused by User Account Control (UAC)。 (他们是一样的。) 类似的主题也描述了限制是Run with UI Access(可在线或在本地帮助中获得)。

3
投票

似乎Autohotkey在OneNote上存在问题。做一些试验和错误我发现做:

Send {CTRL DOWN}{UP}{CTRL UP}

模拟向上键但不完全。


2
投票

似乎很多人都遇到过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用户似乎没有任何问题。我可以问你用的是什么电脑吗?

希望能帮助到你!


2
投票

我的解决方案

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}

1
投票

Simplest way.

!i::ControlSend, OneNote::DocumentCanvas1, {Up}, ahk_exe ONENOTE.EXE

发现在ahk论坛here (original)here (citing original I think)。已经过验证,在Windows 10 1803上使用OneNote 2016(桌面版)。

© www.soinside.com 2019 - 2024. All rights reserved.