web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Window Focus

(0) ShareShare
ReportReport
Posted on by
I have a legacy program, over 10 years old, which I am trying to automate to extract data for a new system. The problem is that i can write the flow, run it to test it and it seems all ok. Then I make a change and/or close the old program and restart it, and some of my UI automation controls can't find the window to work.
I have tried several different ways  to keep the focus, but I am really struggling with it. I am running the latest update version on Windows 11( MSI install, not MS Store version)
I tried launching the software and logging in with PAD, etc.  I wanted to try using a handle to pull the focus, but can't seem to find any consistent instructions on how to create/locate a handle.
Tried asking chatgpt but it can't make up it's mind which version it is talking about and keeps telling me to use commands that don't exist!
Categories:
I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,535 Super User 2026 Season 1 on at
    I think it could be that the legacy program has some attribute in an element that changes every instance. So when ever you open the program either the window element or the actual elements the get new value in some of its elements attributes. So for example: If you would have window element like this it could be that the "Class" has different value every time you open the program. And if your Selector of UI element is set to look for that certain value then it wont find it since that changes everytime.


    Or similarly it could be the elements you captured (not their window element) that has elements that change every new instance. For example an id might change:


    Sometimes also I have automated a system that has date on some of the elements name attribute.


    In that case if the selector needs that Name attribute I would change the operator to be "Starts with" and remove the end part of the value (which also has the date part which changes every day)


    So go through the elements and window elements and remove everything that might be different on different instance of the program. Either toggle of the attributes so the selector doesn't look for those values or change the operator and value to be so that it ignores the parts that change.

    I recommend running the flow and when it fails open the UI selector that failed and use the "Test" functionality to see which element fails in that selector


    One thing also to try with legacy apps is to use MSAA capturing mode when capturing elements.
    https://learn.microsoft.com/en-us/power-automate/desktop-flows/recording-flow#selecting-a-capturing-mode-when-working-with-desktop-applications

    https://learn.microsoft.com/en-us/power-automate/desktop-flows/ui-elements#ui-elements-types


    About ChatGPT giving poor answers: ChatGPT will often mix Power Automate Desktop and Power Automate (cloud that is in the maker portal). So when you ask it questions specify that you are talking about Power Automate Desktop (PAD) not Power Automate that is the browser based automation tool (https://make.powerautomate.com/)
    If you have paid plan check if you can find Custom GPT that is created for Power Automate Desktop.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 535

Last 30 days Overall leaderboard