Skip to content

Instantly share code, notes, and snippets.

@kimushu
Created April 24, 2016 15:03
Show Gist options
  • Save kimushu/8f675878d9b2f8dc6d704483b7751ef8 to your computer and use it in GitHub Desktop.
Save kimushu/8f675878d9b2f8dc6d704483b7751ef8 to your computer and use it in GitHub Desktop.
Shortcut for moving active window to the next monitor
#UseHook on
#NoEnv
#WinActivateForce
#SingleInstance
;--------------------------------------------------------------------------------
; ウィンドウのモニタ間移動
;
MoveToNextMonitor() {
WinGetPos,X,Y,,,A
SysGet,MC,MonitorCount
Move := 0
Loop,% (MC+1) {
MI := Mod(A_Index - 1, MC) + 1
If(Move == 1) {
SysGet,MA2_,Monitor,%MI%
WinMove,A,,(X - MA1_Left + MA2_Left),(Y - MA1_Top + MA2_Top)
Break
}
SysGet,MA1_,Monitor,%MI%
If(MA1_Left <= X && X < MA1_Right && MA1_Top <= Y && Y < MA1_Bottom) {
Move := 1
}
}
}
#Esc::
MoveToNextMonitor()
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment