Active window

For the operating system, the active window is the window that is on focus, or, better yet, the window where the cursor has focus to interact with its elements.

In surface automation, this concept of active window is true. However, when automating applications of Microsoft™ Windows, the IBM Robotic Process Automation driver works on the window that is attached to the driver, which is called the active window or the attached window.

There must be an active window, or a window that is attached to the driver, always for the bot runtime to interact with the controls of the application when using the Windows driver. Otherwise, the bot runtime raises WindowNotAttachedException.

You can either attach the driver to an application’s window that is already running or start an application and attach to its window in a seamless integration.

Launching and attaching window

Use the following commands to launch or attach an opened window:

  • Launch and Attach Window
    Launches an application and then either attaches the application’s window to the driver or searches for a window considering the selector set in the command and then attaches it to the driver if found.

  • Launch or Attach Window
    Searches for an application’s window by using the selectors set for the command. If the bot runtime finds the window, attaches it to the driver. Otherwise, it launches the application set in the command and attaches the window to the driver.

  • Attach Window
    Attaches a window to the driver, making it the active window.

Attention:This command only attaches open windows to the driver, otherwise, it does not open new windows.

Finding and waiting window

Use the following commands to find or wait windows, either through the window itself or through controls.

  • Find Window and Find Windows
    Find open windows that match the defined criteria.

  • Wait Control
    Waits for a control specified by a user-defined selector to appear, returning the success or failure in running the command in the "success" variable.

  • Wait for Control to Enable
    Waits until the control is enabled by using the Timeout parameter as a maximum wait time for the control. At the end, it returns whether it is enabled or not.

  • Wait for Window to Appear
    Waits for an open window that corresponds to the defined criteria to appear.

    Tip:You can use the IBM RPA Studio's recorder to obtain the following information:
    • "Class Name", used in Class Name.
    • "Id", used in Identifier.
  • Wait for Window to Close
    Waits for a window to close, according to defined timeout.

Watching and closing window

Use the Watch and Close Window command to watch for the opening of any new window that matches the defined criteria and closes it soon as it opens.

You can cancel the continuous execution of the Watch and Close Window command by using the Cancel Token Source command and the token that is returned in the Cancel Token Source parameter.

Focusing window

Use the Focus Window command to focus on a window, bringing it to the foreground.