I have this code which I use to relocate my mouse cursor to the centre of the screen any time it goes missing.
Code: Select all
MButton & WheelDown::
CoordMode, Mouse, Screen
SysGet, PriMon, Monitor, %MonitorPrimary%
MX := (PriMonLeft + PriMonRight)//2
MY := (PriMonTop + PriMonBottom)//2
MouseMove, MX, MY
return
MButton::Send {MButton}
My problem is that it interferes with control and function of programs AutoDesk Fusion 360 (window title: Autodesk Fusion 360 (Startup License)) and Google Sketchup (window title: SketchUp Make 2017). Thus I want to disable this code any time either of those programs is the active window. My first attempt to do this was tested for Windows Notepad but it doesn't work.
Code: Select all
#IfWinActive, ahk_class Notepad
#IfWinActive
MButton & WheelDown::
CoordMode, Mouse, Screen
SysGet, PriMon, Monitor, %MonitorPrimary%
MX := (PriMonLeft + PriMonRight)//2
MY := (PriMonTop + PriMonBottom)//2
MouseMove, MX, MY
return
MButton::Send {MButton}
I copied this solution directly from
https://www.autohotkey.com/docs/Hotkeys.htm#Context but the mouse-cursor-relocation code remains functional when Notepad is the active window, so it doesn't seem that this approach is going to work for me.