Robot Task Activities - Windows
The Windows activities find application windows and attach to, show, hide, close, maximize, minimize, restore, move or resize them.

Click Click to select on an activity to pick a window in the UI and fill in the search properties. Every activity in this category fails if the window is not found within WaitForWindow.
A window handle changes each time a window is closed and opened again. When the handle in WindowHandle no longer finds the window, the activity searches by ProcessName and Title instead, so fill those in as well.
Attach Window
Finds a window and runs the activities in its Do body against that window. Activities in the body that work on a window or an element use the attached window without searching for it again.

Properties
The Windows activities share these properties. Attach Window also has AttachedWindow.

- ProcessName: the name of the process that owns the window
- Title: the window title. Supports the wildcards
*,?and# - WindowHandle: the handle of the window, when it is known. Default: "0"
- Window: a window object, for example the AttachedWindow of another activity, to use instead of searching
- AttachedWindow: an output that receives the attached window, for use in a later activity's Window property
- SetFocus: give the window focus before the activity acts on it. Default: cleared
- WaitForWindow: how long to wait for the window, in milliseconds. Default: "10000"
- Wait before and Wait after: the wait in milliseconds before and after the activity runs. When empty, the playback speed from the Robot Task settings is used
At least one of ProcessName, WindowHandle and Window must be filled in.
How the window is found
Attach Window uses the Window property when it is set. Otherwise it searches: first by WindowHandle, then by ProcessName and Title. When a Title with wildcards matches several windows, Attach Window uses the first one, and runs its body once.
The other Windows activities find their window in this order:
- The Window property, when it is set
- The window of a parent Attach Window or Get Active Window activity
- A search by WindowHandle, then by ProcessName and Title
When a Title with wildcards matches several windows, these activities act on every matched window.
Get Active Window
Gets the window that is active and runs the activities in its Do body against it, so the activities in the body do not need to search for a window. The ActiveWindow output receives the window, and SetFocus gives it focus first. The activity fails if no window is active.

Close Window
Finds the window or windows and closes them. The activity fails if a window cannot be closed this way.

Hide Window
Finds the window or windows and hides them.

Show Window
Finds the window or windows and shows them.

Maximize Window
Finds the window or windows and maximizes them.

Minimize Window
Finds the window or windows and minimizes them.

Restore Window
Finds the window or windows and restores them to their normal size and position.
Resize Window
Finds the window or windows and resizes them.

- Width: the new window width, in pixels. Default: "0"
- Height: the new window height, in pixels. Default: "0"
Move Window
Finds the window or windows and moves them.

- X: the new horizontal screen position. Default: "0"
- Y: the new vertical screen position. Default: "0"
Output and errors
- Close Window, Maximize Window, Minimize Window, Restore Window, Resize Window and Move Window fail if the window does not offer the action at all
- When a window offers resizing or moving but its size or position is fixed, Resize Window and Move Window write a line to the Task output and leave the window as it is, and the Task reports success
Tips
- Put a group of window activities inside one Attach Window activity rather than repeating the search properties on each one. It is faster, and there is only one place to update if the window title changes
- Set WaitForWindow rather than adding a fixed Wait activity before working with a window that takes time to open. The activity continues as soon as the window is found
- Use wildcards in Title for windows whose title changes, for example
*- NotepadorInvoice * - Contoso. Remember that a wildcard can match more than one window - Check SetFocus on Attach Window when the body has Keyboard activities, because those send input to the window that has focus
- Run Maximize Window at the start of a sequence to give the window a known size, which keeps element positions and screenshots the same from run to run