Attach Window

Attaches a window that is not being automated to the automation context.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

The command attaches a window that the user has already opened to the current automation context and brings the window to the foreground.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

attachWindow --window(Window)

Dependencies

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Window window Required Window Window variable that you want to attach to the automation context.

Example

Two windows are opened: Notepad and Paint. Each window is stored in a different variable: window01 and window02, respectively. The Attach Window command attaches the first window to the automation context, so the command Type Text (typeText) writes the text "IBM" only in the first open window.

defVar --name window01 --type Window
defVar --name window02 --type Window
launchWindow --executablepath "notepad.exe" --timeout 00:00:20 window01=value
launchWindow --executablepath "mspaint.exe" --timeout 00:00:20 window02=value
attachWindow --window ${window01}
typeText --text "IBM"
Remember:The example above does not work on Windows 11. IBM RPA does not support Windows 11 UWP applications.

Limitations

This command only attaches open windows to the automation context, therefore, it does not start new windows.