autohotkey:模拟按住鼠标

时间:2019-12-07 11:19:16

标签: windows autohotkey

我正在尝试使用自动快捷键进行制作:

  • 按住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 +左键单击”,并且必须手动按下它们以(激活和)停用它们。

1 个答案:

答案 0 :(得分:1)

尝试一下

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