0
votes

Using autohotkey, I am trying to do make:

  • pressing and holding LCtrl & LShift behave like pressing and holding RCtrl + Left mouse button
  • releasing LCtrl & LShift behave like releasing RCtrl + Left mouse button

ideally the order in which the keys are pressed should not matter.

What I have at the moment is:

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

While pressing ^LShift does simulate pressing RCtrl & Left click, releasing ^LShift does nothing most of the time. Usually, even if I release them, RCtrl + Left click keep being "pressed" and I have to manually press them to (activate and) deactivate them.

1

1 Answers

3
votes

Try this

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

EDIT:

To make it work no matter the order in which you press the keys, try this:

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