AutoIt WinMove

Used to move and resize windows.

3002 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

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)

Tell us what you think:

  1. How to declare and work with variables in AutoIt, as well as some background information.
  2. Everything you need to know about working with minimized windows.
  3. How to set the request headers when performing HTTP requests.
  4. This Tutorial will focus on post requests in AutoIt, using the Winhttprequest.5.1 object.
  5. How to use while, for, and do until loops, and how to loop through arrays and object in AutoIt.

More in: AutoIt Tutorials