我有一个程序,当按下 MButton 并上下移动鼠标时它会缩放。
因为这对我来说似乎有点奇怪,所以我决定使用 AHK 让这个程序在按下 RButton 并转动鼠标滚轮时缩放。
这是我的不起作用的想法(注释掉了另一种不起作用的方法):
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 1 ; 1: A window's title must start with the specified WinTitle to be a match.
#IfWinActive Zooming Viewer
~RButton & WheelDown::
Click, up, right
Click, down, middle
Click, Rel, 0, 10, 0
Click, up, middle
Click, down, right
~RButton & WheelUp::
Click, up, right
Click, down, middle
Click, Rel, 0, -10, 0
Click, up, middle
Click, down, right
; MouseClick, R, , , , , U
; MouseClick, M, , , , , D
; MouseClick, , 0, -10, , , , R
; MouseClick, M, , , , , U
; MouseClick, R, , , , , D
感谢任何提示让我开始这项工作,彼得
答案1
谢谢,Mikhail V. 这是正确的建议,导致创立了Ctrl-滚轮成功了。其次,将 SendMode 改为“Event”可以增加稳定性。第三,“return”有助于隔离两个缩放方向。
因此,这是可行的:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
SendMode Event
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 1 ; 1: A window's title must start with the specified WinTitle to be a match.
#IfWinActive Zooming Viewer
~RButton & WheelDown::
Send {Ctrl Down} {WheelUp} {Ctrl Up}
return
~RButton & WheelUp::
Send {Ctrl Down} {WheelDown} {Ctrl Up}
return