Jump to content
Sign in to follow this  

[UDF] WinMove (Moves and/or resizes a window to get the right control size.)

Recommended Posts


Moves and/or resizes a window to get the right control size (only works on windows where the control resizes relatively to the window).

Can be used to resize a browser window for making a screenshot of a certain size.


_WinMove($title, $text, $controlID, $x, $y, $width, $height[, $speed = Default])


; $title      - The title of the window to move/resize. See Title special definition.
; $text    - The text of the window to move/resize.
; $controlID  - The control to interact with. See Controls.
; $x          - X coordinate to move to.
; $y          - Y coordinate to move to.
; $width      - New width of the control.
; $height    - New height of the control.
; $speed      - [optional] the speed to move the windows in the range 1 (fastest) to 100 (slowest). If not defined the move is instantaneous.

Return values

; Success - 1
; Failure - 0, sets @error
; |1 - if control is not found
; |2 - if window is not found


This example moves and resizes a Chrome window with www.google.com open to make the page exactly 960x600.

Screens: window before, control before, window after, control after (with the exact size of 960x600).


#include <WinMove.au3>
_WinMove("[TITLE:Google - Google Chrome;CLASS:Chrome_WidgetWin_0]", "", "[CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1]", 0, 0, 960, 600, 2)
Switch @error
Case 1
  MsgBox(0, "", "Control is not found")
Case 2
  MsgBox(0, "", "Window is not found")


Well... I'm an AutoIt newbie so far (as u can see at my member title lol) but I thought maybe others would like to have this piece of code anyway.

If you have any tips or anything feel free to tell me.

Edited by 1RV34

MsgBox(0x40040, "", "Hello Forum!")

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...