autohotkey:模拟鼠标按住
autohotkey: simulate mouse press and hold
使用自动热键,我正在尝试制作:
- 按住 LCtrl 和 LShift 的行为类似于按住 RCtrl + 鼠标左键
- 释放 LCtrl 和 LShift 就像释放 RCtrl + 鼠标左键一样
理想情况下,按键的顺序应该无关紧要。
我现在有的是:
LCtrl & LShift::
If (A_PriorHotKey = A_ThisHotKey) ;these are built in variables
return
Send {RCtrl Down}
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
return
LCtrl & LShift Up::
Send {RCtrl Up}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
虽然按下 ^LShift 确实模拟按下 RCtrl 和左键单击,但释放 ^LShift 在大多数时间 什么都不做。通常,即使我松开它们,RCtrl + 左键单击仍然是 "pressed",我必须手动按下它们来(激活和)停用它们。
试试这个
LCtrl & LShift::
Send {RCtrl Down}
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
KeyWait, LCtrl ; Wait for LCtrl to be released
Send {RCtrl Up}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
编辑:
要使其无论按什么顺序都能正常工作,试试这个:
LCtrl & LShift::
LShift & LCtrl::
Send {Blind}{Shift Up}
Send {RCtrl Down}
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
KeyWait, LCtrl ; Wait for LCtrl to be released
Send {RCtrl Up}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
使用自动热键,我正在尝试制作:
- 按住 LCtrl 和 LShift 的行为类似于按住 RCtrl + 鼠标左键
- 释放 LCtrl 和 LShift 就像释放 RCtrl + 鼠标左键一样
理想情况下,按键的顺序应该无关紧要。
我现在有的是:
LCtrl & LShift::
If (A_PriorHotKey = A_ThisHotKey) ;these are built in variables
return
Send {RCtrl Down}
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
return
LCtrl & LShift Up::
Send {RCtrl Up}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
虽然按下 ^LShift 确实模拟按下 RCtrl 和左键单击,但释放 ^LShift 在大多数时间 什么都不做。通常,即使我松开它们,RCtrl + 左键单击仍然是 "pressed",我必须手动按下它们来(激活和)停用它们。
试试这个
LCtrl & LShift::
Send {RCtrl Down}
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
KeyWait, LCtrl ; Wait for LCtrl to be released
Send {RCtrl Up}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
编辑:
要使其无论按什么顺序都能正常工作,试试这个:
LCtrl & LShift::
LShift & LCtrl::
Send {Blind}{Shift Up}
Send {RCtrl Down}
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
KeyWait, LCtrl ; Wait for LCtrl to be released
Send {RCtrl Up}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return