LumetriFlow
LumetriFlow

Reputation: 70

AHK Remapping Middle Mouse button to something else

After a month of trial and error, I've finally found a solution!

How to remap Middle mouse button something else? If you don't have a three-button mouse, this is a must-have for blender (esp. Laptop)

I'm aware of "emulate 3 button mouse" in Preference>>Input. But if you check that option then you won't be able to 'Select loop' which uses ALT leftClick.

What if you could remap Mbutton to any other key you rarely use? Yes you can!

Upvotes: 1

Views: 1677

Answers (2)

0x464e
0x464e

Reputation: 6489

Nice to see that you tried it yourself.
But here's how a context sensitive remap is actually done:

#IfWinActive ahk_class GHOST_WindowClass
LWin::MButton
#IfWinActive

Upvotes: 3

LumetriFlow
LumetriFlow

Reputation: 70

This script will allow you to remap Mbutton with other key, such as LeftWin.

;~--------------------------------------------------------------------------------------

#IfWinActive ahk_class GHOST_WindowClass ;      Blender's class
$LWin::   ;                                     "$" this allows to send the trigger key in a working script***
loop
{
   if getkeystate("LWin", "p")           ;      if a button is Physically held down by the user.
    {
      send, {MButton DOWN}
    }
  else
    {
      send, {MButton UP}
      ;~ MsgBox, Blender is active       ;      You dont need this.
      return
    }
}
#IfWinNotActive ahk_class GHOST_WindowClass ;   Other than blender (I'm aware of other methods, but this works for me!)
Send, {LWin}                            ; ***   like here I'm able to use Left Win again without triggering the script.
;~ MsgBox,Blender isnt active ;;                You dont need this.
return


;~ --------------------------------------------------------------------------------------

Upvotes: 0

Related Questions