Set the checkbox state in the window in which the window title changes dynamically (UI automation > Form filling)

565 Views Asked by At

I'm trying to create a flow where it checks the status of the checkbox for multiple windows (i.e. Windows app which changes the title dynamically). Currently, "set checkbox state window" in power automate desktop will allow to select form app window with the static title, but I need for desktop app window which changes title dynamically.

For e.g. In "Set checkbox state in the window", if we choose with Title "Demo App" and if that window changes its title to "Project A - Demo App" then "Set checkbox state in the window" unable to find the window.

Is there any possible way to get the result I needed?. So, any help would be greatly appreciated. Thanks in advance.

enter image description here

1

There are 1 best solutions below

0
On

It's quite difficult to give you an answer that you'll just be able to take and use yourself but I can give you the concept and you can take it from there.

I created a basic flow that looks like this ...

Flow

All it does is open notepad, write in some text and save the file into c:\temp\test.csv ...!

There are a couple of intermediate steps for creating the file in question so that the flow works, etc. but that's nominal to the process.

In the flow itself, I have a UI Element which links to the main text area within notepad. In a later step, I want to select that textarea but between opening notepad and saving the file, the title of the window changes.

Before Save

Before Save

After Save

After Save

If the name of my file changes, I need to be able to change the name of the window that I am wanting to select and that selection happens in the second last step where it is trying to focus on a text field in the given window.

If the selector isn't correct then that step will not be able to find the window and an error will be thrown.

The easiest way to do this is to anticipate what the name of the window is going to be and make the selection dynamic. So as an example, the UI Element selector for the window before the file is saved is this ...

:desktop > window[Name="Untitled - Notepad"][Process="notepad"]

... and after the save is this ...

:desktop > window[Name="test.csv - Notepad"][Process="notepad"]

You'll see that the way I have done this is to make the selector dynamic by passing in the name of a variable that stores the name of the file I am saving to.

The selector then looks like this ...

:desktop > window[Name="%FileName% - Notepad"][Process="notepad"]

Variables

So no matter what my file name is, the selector should always work because I have allowed for the name of the window to change.

As I said, that's a simple way to do it and shows you an example, you just need to adapt it to your scenario.