[Windows]在主副屏间快速移动鼠标和窗口

安装

安装 ahk 新建一个名为 mouse_right.ahk 的文件;如果主屏幕在左边的,文件名改为mouse_left.ahk(其实只有主屏幕是在左边副屏是在右边的,这个文件名才是 必须的)

由于蓝奏云需要手机号注册,因此暂时不提供exe下载链接。

下载链接:https://transfer.sh/1dCdWse/mouse.exe (如果主屏幕是在左边,将其命名为mouse_left.exe

快捷键是ALT+QALT+W,有鼠标侧键的可以修改为侧键。

移动鼠标是经过屏幕分辨率计算的,移动窗口是利用的WIN_10快捷键,因此如果系统是WIN_7或者WIN_XP可以解开下面的if (A_OSVersion in WIN_7,WIN_XP){注释试试 (未经过测试)

#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.

CoordMode, Mouse,Screen
SysGet, Mon1, Monitor, 1
SysGet, Mon2, Monitor, 2

isLeft := StrSplit(A_ScriptName, ".")[1] == "mouse_left" ? 1 : 0

!q::
WinMove, X, Y
;if (A_OSVersion in WIN_7,WIN_XP){
; if (isLeft = 0){
;    if (xpos < 0){
;        WinMove, Mon2Left, Mon2Top ;TODO
;     }
;     else{
;        WinMove, 0, 0
;     }
;   }
;   else{
;      if (xpos > Mon1Right){
;        WinMove, 0, 0
;      }
;      else{
;        WinMove, Mon2Left, Mon2Top
;      }
;   }
;} else{
  Send #+{Left}
  Send !w
;}
return

!w::
  MouseGetPos, xpos, ypos 
  if (isLeft = 0){
    if (xpos < 0){
      MouseMove Mon1Right/2, Mon1Bottom/2
    }
    else{
      MouseMove Mon2Left/2, (Mon2Bottom+Mon2Top)/2
    }
  }
  else{
    if (xpos > Mon1Right){
      MouseMove Mon1Right/2, Mon1Bottom/2
    }
    else{
      MouseMove (Mon2Right+Mon1Right)/2, (Mon2Bottom+Mon2Top)/2
    }
  }
return