Sign in to follow this  
Followers 0
1RV34

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

1 post in this topic

#1 ·  Posted (edited)

WinMove.au3

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.

Syntax

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

Parameters

; $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

Example

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).

Example.au3

#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")
EndSwitch

Notes

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  
Followers 0