1
votes

I want my autohotkey script to have mouse clicks once i press shift+3 keys on my keyboard, ignoring the shift key being held down.

For example I have attempted it in this way:

   +3::
SetMouseDelay, 0
MouseGetPos, xpos, ypos
Send {Shift Up}
BlockInput, on
Send {Shift Up}
MouseClick, right, uhxpos, uhypos
Sleep, 41
MouseClick, left, yourxpos, yourypos
MouseMove, xpos, ypos
BlockInput, off
return

And even tried to wait once the shift is physically released, still no success;

+3::
SetMouseDelay, 0
MouseGetPos, xpos, ypos
KeyWait, +  
MouseClick, right, uhxpos, uhypos
Sleep, 41
MouseClick, left, yourxpos, yourypos
MouseMove, xpos, ypos
return

Would appreciate any help, thanks.

2
So, you are holding shift while you push shiftf3? Or is it that you want the routine to run after you push shiftf3 but despite the possibility that shift is held down?bgmCoder
Maybe you are going about this the wrong way. What exactly are you trying to accomplish by tring to block shift?bgmCoder

2 Answers

2
votes

Try to send {Shift Down} before {Shift Up} and maybe you should replace Send with SendInput:

+3::
  MouseGetPos, xpos, ypos
  SetMouseDelay, 0
  Sleep, 100
  SendInput, {Shift Down}
  SendInput, {Shift Up}
  MouseClick, right, uhxpos, uhypos
  Sleep, 41
  MouseClick, left, yourxpos, yourypos
  MouseMove, xpos, ypos
Return
0
votes

use KeyWait, Shift instead of KeyWait, +