Table of Contents

Window

Window management object than can be used to represent a window on the desktop.

Functions

Window

Constructor function.

Syntax

var myObject = new Window();
var myObject = new Window(otherWindow);

Arguments

  1. otherWindow - (Window) other Window to copy

Exceptions

Example

Create an invalid Window.

var myObject = new Window();

Create a Window representing a copy of otherWindow.

var myObject = new Window(otherWindow);

all

Returns an array of Window representing all the windows on the desktop.

Syntax

Window.all();

Returns

Example

This example will print all the windows titles in the console.

var windows = Window.all();
for(var i = 0; i < windows.length; ++i)
    Console.print(windows[i].title() + "\n");

find

Searches for windows matching some criteria. Any omitted criteria is not used. Only windows matching all criteria are returned.

Syntax

Window.find(parameters);

Arguments

  1. parameters - (object) search parameters
    • title - (string) window title
    • titleMode - (enum) see match modes for the list of possible values
    • titleCaseSensitive - (bool) set this to true if you want the title matching to be case sensitive
    • className - (string) window class name
    • classNameMode - (enum) see match modes for the list of possible values
    • classNameCaseSensitive - (bool) set this to true if you want the class name matching to be case sensitive
    • processId - (integer) set this to a process id to get only windows owned by this process
    • process - (ProcessHandle) set this to an instance of a ProcessHandle id to get only windows owned by this process

Returns

Exceptions

Example

Find the window called "Notepad".

var windows = Window.find({
	title: "Notepad"
});

Find the windows whose title starts with "Notepad", using wildcards.

var windows = Window.find({
	title: "Notepad*",
	titleMode: Window.Wildcard
});

You can use the following code to show the title of all found windows :

for(var i = 0; i < windows.length; ++i)
	Console.print(windows[i].title() + "\n");

Methods

clone

Returns a copy of this Window.

Syntax

myObject.clone();

Returns

Example

var copyOfMyObject = myObject.clone();

equals

Returns true if this Window and another are referencing the same window.

Syntax

myObject.equals(other);

Arguments

  1. other - (Window) another Window

Returns

Example

if(myFirstObject.equals(mySecondObject))
	//Do something

toString

Returns a string representing this Window.

Syntax

myObject.toString();

Returns

Example

Console.print(myObject.toString());

Notes

This method is automatically called when trying to convert a Window to a string.

isValid

Returns true if this Window is referencing a window, false otherwise.

Syntax

myObject.isValid();

Returns

Example

if(myObject.isValid())
	//Do something

title

Returns the title of the current window.

Syntax

myObject.title();

Returns

Exceptions

Example

Console.print(myObject.title());

className

Returns the class name of the current window.

Syntax

myObject.className();

Returns

Exceptions

Example

Console.print(myObject.className());

isActive

Returns true if this Window is the foreground Window, false otherwise.

Syntax

myObject.isActive();

Returns

Exceptions

rect

Returns a Rect representing the rectangle of the window.

Syntax

myObject.rect();
myObject.rect(useBorders);

Arguments

- useBorders - (bool) use window borders when resizing the window (default: true) [Added in Actionaz 3.2.0.]

Returns

Exceptions

process

Returns a ProcessHandle representing the process owning the window.

Syntax

myObject.process();

Returns

Exceptions

close

Close this window.

Syntax

myObject.close();

Returns

Exceptions

killCreator

Kill the process owning this window.

Syntax

myObject.killCreator();

Returns

Exceptions

setForeground

Set this window to the foreground.

Syntax

myObject.setForeground();

Returns

Exceptions

minimize

Minimize the window.

Syntax

myObject.minimize();

Returns

Exceptions

maximize

Maximize the window.

Syntax

myObject.maximize();

Returns

Exceptions

move

Move the window.

Syntax

myObject.move(point);

Arguments

  1. point - (Point) point where to move the window

Returns

Exceptions

resize

Resize the window.

Syntax

myObject.resize(size);
myObject.resize(size, useBorders);

Arguments

  1. size - (Size) the new size of the window
  2. useBorders - (bool) use window borders when resizing the window (default: true) [Added in Actionaz 3.2.0.]

Returns

Exceptions

Enumerations

Match mode

Match modes for the find function.

Values

  1. RegExp: search using regular expressions
  2. Wildcard: search using wildcards
  3. WildcardUnix: search using Unix type wildcards
  4. FixedString: search using a fixed string

Example

Find the windows whose title starts with "Notepad", using wildcards.

var windows = Window.find({
	title: "Notepad*",
	titleMode: Window.Wildcard
});