Core Function WinGetPos

From Sputnik Wiki
Jump to: navigation, search
WinGetPos ( <title>, <text> )

Contents

Description

Retrieves the position and size of a given window.

Parameters

Title

The title of the window.

Text

Optional; The text of the window to read.

Return Value

Success: Returns a 4-element array containing the following information:

$array[0] = X position 
$array[1] = Y position 
$array[2] = Width 
$array[3] = Height 

Failure: Returns 0.

Remarks

WinGetPos returns negative numbers such as -32000 for minimized windows, but works fine with (non-minimized) hidden windows.

If the window title "Program Manager" is used, the function will return the size of the desktop.

If multiple windows match the criteria, the most recently active window is used.

See "WinTitleMatchMode" in Opt

Example

// Get a window
List ($x, $y, $w, $h) = WinGetPos("Calculator");
println("The window stats (x,y,width,height): $x, $y, $w, $h");
 
// Get active window
List ($x, $y, $w, $h) = WinGetPos("");
println("Active window stats (x,y,width,height): $x, $y, $w, $h");
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox