Reputation: 223
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.
Upvotes: 1
Views: 1884
Reputation: 15488
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
Upvotes: 3