1

Is there a way I can assign a key to block other keys using autohotkey? I've tried this, tried adding parentheses nothing works

Here is the code

g::

lbutton::
rbutton::
BlockInput, MouseMove

return

as you can see, i want to block mouse input if i pressed g can anyone help me solve this problem please?

  • I've been looking for a solution for 2 hours before posting this so please don't report as repeated
3
$g::
Mouse_Blocked := true   ; assign the Boolean value "true" or "1" to this variable
BlockInput, MouseMove   ; disable MouseMove
return

; The #If directive creates context-sensitive hotkeys

#If (Mouse_Blocked) ; If this variable has the value "true" 

    ; block mouse input:
    LButton::
    RButton::
    WheelUp::
    WheelDown::
    return

    $g::    ; press g to re-enable MouseMove and mouse input
    BlockInput, MouseMoveOff
    Mouse_Blocked := false
    return


#If ; turn off context sensitivity

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.