mov left top [window] [flags] siz width height [window] [flags]
left and top - new coordinates of the window's top-left corner. Type - integer or double. If integer - pixels. If double - fraction of the screen (usually from 0.0 to 0.999).
width and height - new width and height of the window. Type - integer or double. If integer - pixels. If double - fraction of the screen (usually from 0.0 to 0.999).
window - top-level or child window.
| 1 | don't change left or width; |
| 2 | don't change top or height; |
| 4 | coordinates are relative to the work area. Only with top-level windows. |
mov changes window position.
siz changes window dimensions.
If window is omitted or "", is used currently active window.
The coordinates must be relative to the primary monitor. If you want to use coordinates relative to some other monitor, use function XyMonitorToNormal to convert them.
If it is child window, the coordinates must be relative to the client area of the immediate parent window.
The window position and size will not be changed if it is minimized. Also you should not change it the window is maximized. To ensure that Notepad window is not minimized and not maximized, use this code:
int w2=win("Notepad") if(min(w2)) res w2 if(max(w2)) res w2
The speed depends on spe.
There are more functions to move or resize windows: CenterWindow (move to screen center, corners, certain monitor), EnsureWindowInScreen (ensure that whole window is in its or specified monitor), MoveWindowToMonitor (move window to another monitor), ArrangeWindows (arrange multiple windows, e.g. tile or minimize), SaveMultiWinPos/RestoreMultiWinPos (save/restore positions of multiple windows), AdjustWindowPos, MoveWindow, SetWindowPos, SetWindowPlacement. To get help, type or click function name and press F1. Note that these functions don't accept window name. Must be used window handle. Use function win to get window handle. Also, they accept only integer coordinates.
Move "Notepad". Top-left corner will be at 500, 0 pixels of the screen: mov 500 0 "Notepad" Move "Notepad". Top-left corner will be in a middle of the screen: mov 0.5 0.5 "Notepad" siz 300 200 "Notepad" ;;change "Notepad" size Change "Notepad" size. Width will be = screen width, height - 0.25 of screen height: siz 1.0 0.25 "Notepad" Move active window to the left side of the screen, set height to the screen height minus taskbar height, and don't change width: spe mov 0 0 "" 4 siz 0 1.0 "" 5 Move-resize window: MoveWindow win("Notepad") 100 100 400 400 1