AutoHotkey Script for Unity and Blender to allow middle click toggle between: Transform-Scale-Rotate

When using Unity and Blender I use a 3d mouse in my left hand to move around the environment, but I still needed to move my hand to the keyboard to switch between Transform, Scale and Rotate. This Autohotkey script allows me to do that with the redundant middle-click mouse button.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


SetTitleMatchMode 2

#IfWinActive, ahk_exe Unity.exe
{
x := 1
return

*MButton::
If x = 1
   Send w
Else If x = 2
   Send e
Else If x = 3
{  Send r
   x := 0
}
x++
return
}
#IfWinActive

#IfWinActive, ahk_exe blender.exe
{
x := 1
return

*MButton::
If x = 1
   Send r
Else If x = 2
   Send g
Else If x = 3
{  Send s
   x := 0
}
x++
return
}
#IfWinActive

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.