ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

move mouse to active window

<< < (3/3)

lanux128:
this code moves the cursor to any active window if switching between apps on the primary and secondary monitor and among apps on the secondary monitor. however if you're switching among apps on primary screen, the cursor is left alone.

i had to put in some manual methods to achieve what i wanted, maybe it will be useful to someone..


--- ---;assume it's a 2-monitor setup
SysGet, Mon2, Monitor, 2

~!Tab::
KeyWait, Alt
KeyWait, Tab

WinGetActiveStats, getTitle, width, height, x, y
If x >= 1440  ; 2nd monitor as 1st monitor's res is 1440
{
  center_x:=(Mon2Right-Mon2Left)/2
  center_y:=(Mon2Bottom-Mon2Top)/2
}
Else If (x >= 0 and x < 1440) ; 1st monitor
{
   MouseGetPos, cur_x, cur_y
   If (cur_x >= 0 and cur_x < 1440)
    {
     center_x:=cur_x
     center_y:=cur_y
    }
  Else
    {
   center_x:=x+width/2
   center_y:=y+height/2
    }
}
Else If x < 0
{
; do nothing as it's probably minimized
}
MouseMove,center_x,center_y,

Return

Navigation

[0] Message Index

[*] Previous page

Go to full version