在我的笔记本电脑上,Palm拒绝是垃圾,因此我禁用了HID触摸屏,以便仅输入笔输入。因此,我使用AHK编写了一个脚本,该脚本将在用户按下ALT
之后在页面上滚动,并在第二次按下ALT
时禁止滚动。
它很好用,除了在OneNote(Win 10应用程序)中,笔光标输入被OneNote劫持了。例如,如果我创建一个ToolTip, %xPos% %yPos%
,则当笔形光标悬停在OneNote窗口上方的任何位置时,它将不会更新。在此以外的任何地方都可以正常工作。
在OneNote获得AHK之前,如何使AHK窃取笔形光标输入?
isTabletMode := 1
penScrollActive := 0
#MaxThreadsPerHotkey 2 ; Allows a second instance to modify penScrollActive while PenScroll is looping.
$Alt::
; Check if PC is in tablet mode.
; 1 --> Tablet, 0 --> Desktop
RegRead, isTabletMode, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShell,TabletMode
if(isTabletMode) {
if(penScrollActive) {
penScrollActive := 0 ; We are already scrolling, so turn it off.
}
else {
penScrollActive := 1 ; We are not scrolling yet, so turn on pen scrolling.
}
GoSub PenScroll
}
else ; If we aren't in tablet mode, then Alt should just send Alt
Send, {Alt}
return
PenScroll:
loop { ; For some reason, while() logic wasn't working, so this is a workaround. Breaks upon the conditional at bottom.
MouseGetPos, mouseX, mouseY
ToolTip, %mouseX% %mouseY% ; For debugging: Output what cursor pos registers as. (This isn't working in OneNote when using the pen input as a cursor (eg. hover) ).
Sleep, 20
MouseGetPos, mouseX_new, mouseY_new
if (mouseX_new - mouseX > 0) ; Horizontal scrolling
Send, {WheelLeft}
else if (mouseX_new - mouseX < 0)
Send, {WheelRight}
if (mouseY_new - mouseY > 0) ; Vertical scrolling
Send, {WheelUp}
else if (mouseY_new - mouseY < 0)
Send, {WheelDown}
if (penScrollActive = 0) ; Conditional to break out
break
}
return
; To Reload the script: Win+`
#`::Reload
Return
#If penScrollActive
LButton::Return
答案 0 :(得分:0)
您可以尝试的一件事是我的AHK的AutoHotInterception库。安装自定义设备驱动程序,然后可以在操作系统下方的驱动程序级别上挂入输入事件。
它支持“绝对”(类似于图形输入板)的鼠标输入
您需要“订阅模式”终结点