1

Wanted a simple script where MButton mapped to hitting the number row key 8 then holding RButton until released.

$MButton::
SendInput {8}
SendInput {RButton Down}
return

$MButton Up::
SendInput {RButton Up}
return

But there's a problem; if Shift is being held, the script does nothing. So I added the wildcard to ignore modifiers:

*$MButton::
SendInput {8}
SendInput {RButton Down}
return

*$MButton Up::
SendInput {RButton Up}
return

But now the script releases Shift on its own when MButton is pressed. How can I make it work ignoring modifiers?

1

Finally found the solution here: https://stackoverflow.com/questions/15380171/send-existing-modifiers-with-a-key-in-autohotkey

{Blind} passes whatever modifiers are being held to the sent inputs, in a wildcard match.

*$MButton::
SendInput {Blind}{8}
SendInput {Blind}{RButton Down}
return

*$MButton Up::
SendInput {Blind}{RButton Up}
return

That seems to work for me.

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.