Again, great work, and thanks for the quick inclusion of my suggestion! I made a couple of minor edits for myself:
This allows the NumpadDot to work for maximized windows:
MoveWindowToNextScreen:
gosub WP_SetLastFoundWindowByHotkey
WinGet, state, MinMax
if state
{
WinRestore
MoveWindowToNextScreen()
WinMaximize
}
else
MoveWindowToNextScreen()
return
Similarly, this allows the "Gather Windows" to work with maximized windows (I only the changed last line of the original function, but I'm posting the whole function for completeness):
GatherWindows(md=1)
{
;SetWinDelay, -1 ; Makes a BIG difference to perceived performance.
; List all visible windows.
WinGet, win, List
; Copy bounds of all monitors to an array.
SysGet, mc, MonitorCount
Loop, %mc%
SysGet, mon%A_Index%, MonitorWorkArea, %A_Index%
; Destination monitor
mdx := mon%md%Left
mdy := mon%md%Top
mdw := mon%md%Right - mdx
mdh := mon%md%Bottom - mdy
Loop, %win%
{
; Set Last Found Window.
if (!WinExist("ahk_id " . win%A_Index%))
continue
WinGetPos, x, y, w, h
; Determine which monitor this window is on.
xc := x+w/2, yc := y+h/2
ms := 1
Loop, %mc%
if (xc >= mon%A_Index%Left && xc <= mon%A_Index%Right
&& yc >= mon%A_Index%Top && yc <= mon%A_Index%Bottom)
{
ms := A_Index
break
}
; If already on destination monitor, skip this window.
if (ms = md)
continue
; Source monitor
msx := mon%ms%Left
msy := mon%ms%Top
msw := mon%ms%Right - msx
msh := mon%ms%Bottom - msy
; If the window is resizable, scale it by the monitors' resolution difference.
if (IsResizable()) {
w *= (mdw/msw)
h *= (mdh/msh)
}
; Move window, using resolution difference to scale co-ordinates.
WinGet, state, MinMax
if state
{
WinRestore
WinMove,,, mdx + (x-msx)*(mdw/msw), mdy + (y-msy)*(mdh/msh), w, h
WinMaximize
}
else
WinMove,,, mdx + (x-msx)*(mdw/msw), mdy + (y-msy)*(mdh/msh), w, h
}
}
And finally, I removed the "SetWinDelay, -1" because of its
AHK Command Reference entry:
Although a delay of -1 (no delay at all) is allowed, it is recommended that at least 0 be used, to increase confidence that the script will run correctly even when the CPU is under load.