AutoIt WinMove
Used to move and resize windows.
3017 views
Edited: 2017-07-26 10:40
The WinMove function of AutoIt is used to move and resize windows.
This function has no effect on minimized windows, so you should first activate the window, before you try to move or resize it.
In addition, there may be some limitations when resizing windows, and these may depend on the individual application.
Parameters
Title | The title of the window. |
Text | The text of the window. |
X (Pixels) | The horizontal coordinate to move to. |
Y (Pixels) | The vertical coordinate to move to. |
Width (Pixels) | Width in pixels of the resize. |
Height (Pixels) | Height in pixels of the resize. |
Speed (1-100) | Speed when moving the window. |
WinMove examples
In the following example, the script will first wait for the Spotify window to appear, and then resize and move it almost immediately. We are using the window classname, which is often a easy way to target specific windows.
$hWnd = WinWait("[CLASS:SpotifyMainWindow]", "", 10) WinMove("[CLASS:SpotifyMainWindow]", "", 0, 0, 1880, 990)
In the below example we will be using the title string of the window, to select Spotify when it opens. I.e.:
$hWnd = WinWait("Spotify", "", 10) WinMove("Spotify", "", 0, 0, 1880, 990)
Tell us what you think: