By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

AutoIt WinMove

Used to move and resize windows.

Edited: 2015-01-15 21:32

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.


TitleThe title of the window.
TextThe 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)