2

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!

LumetriFlow
  • 130
  • 1
  • 11

2 Answers2

4

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
0x464e
  • 5,948
  • 1
  • 12
  • 17
  • I was about to post a similar answer. I understand that your solution focused on refactoring OP's code to show how Context-Sensitive Hotkeys are supposed to be written, but, for this target app of Blender in particular, it may be better to change the `ahk_class GHOST_WindowClass` --> `ahk_exe blender.exe` in order to more reliably prevent the script from targeting other apps in addition to making the conditional self-documenting. – Spyre Jul 19 '21 at 13:21
  • WHAAAT?! It was this simple ಥ_ಥ – LumetriFlow Jul 20 '21 at 08:27
0

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


;~ --------------------------------------------------------------------------------------
LumetriFlow
  • 130
  • 1
  • 11