fail to map Shift-MButton Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
surfactant
Posts: 99
Joined: 28 Jun 2019, 01:07

fail to map Shift-MButton

Post by surfactant » 13 Jul 2022, 04:47

In one of my CAD application, moving mouse cursor,, while holding down both Shift and MButton, would move an object.

I want to map a single key for the operation, but failed. Both mapping statements work the same way as z:MButton. What's wrong? Thanks!

Code: Select all

z::+MButton

z::MButton

User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: fail to map Shift-MButton

Post by mikeyww » 13 Jul 2022, 05:51

Sorting out what AHK does it typically easy, because you can simply examine the :arrow: KeyHistory. How your target window responds to AHK is another issue altogether.

image220713-0650-001.png
Key history
image220713-0650-001.png (11.87 KiB) Viewed 392 times

surfactant
Posts: 99
Joined: 28 Jun 2019, 01:07

Re: fail to map Shift-MButton

Post by surfactant » 13 Jul 2022, 08:10

@mikeyww Thank you for your reply! But not understand well enough.

I ran this,

Code: Select all

z::+MButton
I press down z key, then move mouse and release z key. The operation is same as z::MButton. Here is the key history:
image.png
image.png (4.99 KiB) Viewed 370 times

User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: fail to map Shift-MButton

Post by mikeyww » 13 Jul 2022, 08:14

Try:

Code: Select all

#InstallMouseHook
z::+MButton
Since you are seeing the code execute properly, the issue would appear to be how your target window is responding. Some windows may require admin mode or otherwise addressing user privileges.

You may also want to try Send or some variations of it, to see what happens, instead of remapping your key. The remap is explained as follows.

https://www.autohotkey.com/docs/misc/Remap.htm#actually

surfactant
Posts: 99
Joined: 28 Jun 2019, 01:07

Re: fail to map Shift-MButton  Topic is solved

Post by surfactant » 13 Jul 2022, 08:31

@mikeyww Thanks! After adding #InstallMouseHook, "z::+MButton" still works as "z::MButton".

I just figure it out:

Code: Select all

z::

SendInput {LShift Down}
SendInput {MButton Down}

keywait, z

SendInput {LShift Up}
SendInput {MButton Up}

return

Post Reply

Return to “Ask for Help (v1)”