Created
December 30, 2018 13:26
-
-
Save onionmk2/98daa0768b49db24fd7e3519f8013db7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. | |
; ! is Alt. Alt +1 が押されるまで待機ということ。 | |
!1:: | |
SysGet, monitor1, Monitor, 1 | |
SysGet, monitor2, Monitor, 2 | |
SysGet, monitor3, Monitor, 3 | |
; monitor_1_width := monitor1Right - monitor1Left | |
; monitor_2_width := monitor2Right - monitor2Left | |
; monitor_3_width := monitor3Right - monitor3Left | |
xcenter_of_monitor1 := (monitor1Left + monitor1Right) / 2 | |
xcenter_of_monitor2 := (monitor2Left + monitor2Right) / 2 | |
xcenter_of_monitor3 := (monitor3Left + monitor3Right) / 2 | |
ycenter_of_monitor1 := (monitor1Top + monitor1Bottom) / 2 | |
ycenter_of_monitor2 := (monitor2Top + monitor2Bottom) / 2 | |
ycenter_of_monitor3 := (monitor3Top + monitor3Bottom) / 2 | |
; monitor3 , monitor1 , monitor2 の順に配置している前提を置く。 | |
CoordMode, Mouse, Screen | |
MouseGetPos, x_before_move, y_before_move | |
; monitor2にいるなら monitor1 へ移動 | |
if (monitor1Right < x_before_move) | |
{ | |
x_after_move := xcenter_of_monitor1 | |
y_after_move := ycenter_of_monitor1 | |
MouseMove, x_after_move, y_after_move | |
} | |
; monitor1にいるなら monitor3 へ移動 | |
else If (monitor1Left < x_before_move) and (x_before_move < monitor1Right) | |
{ | |
x_after_move := xcenter_of_monitor3 | |
y_after_move := ycenter_of_monitor3 | |
MouseMove, x_after_move, y_after_move | |
} | |
; monitor3にいるなら monitor 2 へ移動 (サイクル移動) | |
else If (x_before_move <= monitor1Left) | |
{ | |
x_after_move := xcenter_of_monitor2 | |
y_after_move := ycenter_of_monitor2 | |
MouseMove, x_after_move, y_after_move | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment