我已经成功地做到了这一点,当我按住鼠标右键时,我可以使用滚轮控制系统音量。但我现在的问题是,即使我更改了音量,每次释放右键时它仍然会点击右键。
我想保持正常的右键单击,但是当我在宏中使用鼠标右键时(不应该忽略鼠标右键的释放)。在这种情况下,如何最好地添加脚本以忽略鼠标点击?
这就是我现在使用的内容:
~RButton & WheelUp::Send {Volume_Up}
我喜欢它的简洁(其他方式也显示出错误),所以我希望有一个我错过的简单解决方案。
我认为应该可以使用基于计时器的解决方案(例如双击右键作为短键),但我无法使用该解决方案。
以下解决方案我发现Don还没有解决它:
RButton & WheelUp::Send {Volume_Up} ; inactivates right click
RButton:: click right ; gets right click back, but unable to have right click pressed
;(dragging things with right click, etc would be impossible)
RButton & WheelUp:: Send {Volume_Up}
RButton & WheelDown::Send {Volume_Down}
答案 0 :(得分:1)
~RButton & WheelUp::
Send {Volume_Up}
SetTimer, CloseContextMenu, 50
return
~RButton & WheelDown::
Send {Volume_Down}
SetTimer, CloseContextMenu, 50
return
CloseContextMenu:
KeyWait, RButton, R
Send, {Esc}
SetTimer, CloseContextMenu, off
return
答案 1 :(得分:1)
好的,我认为这是一个更好的解决方案。
~RButton & WheelUp::
Send {Volume_Up}
SetTimer, CloseContextMenu, 50
return
~RButton & WheelDown::
Send {Volume_Down}
SetTimer, CloseContextMenu, 50
return
CloseContextMenu:
KeyWait, RButton, R
WinGetTitle, active_title, A
WinGetClass, active_class, A
WinActivate, ahk_class Progman ;desktop
WinWaitActive, ahk_class Progman
Send, {ALT Down}{ALT Up} ; try also: Send, {Esc} (remove the Alt command)
SetTimer, CloseContextMenu, off
WinActivate, %active_title% ahk_class %active_class%
return
答案 2 :(得分:1)
试试这个:
#NoEnv
SendMode Input
#SingleInstance Force
Process, Priority, ,High
#InstallKeybdHook
#InstallMouseHook
#UseHook
#MenuMaskKey vk07 ; is used to mask Win or Alt keyup events
; http://ahkscript.org/docs/commands/_MenuMaskKey.htm
return
~RButton & WheelUp::
Send {Volume_Up}
SetTimer, CloseContextMenu, 50
return
~RButton & WheelDown::
Send {Volume_Down}
SetTimer, CloseContextMenu, 50
return
CloseContextMenu:
KeyWait, RButton, R
Send, {ALT Down}{ALT Up}
SetTimer, CloseContextMenu, off
return