📅 Introduction

If you're working with Power Automate Desktop and scheduling your flows to run .exe files daily, you may have noticed something odd – sometimes, the automation just gets stuck. Why? A random software update pop-up or some annoying system dialog box hijacks the screen!

In this article, I'll show you how to detect and handle such unexpected pop-ups smartly, so that your automation doesn’t fail just because someone decided to update their software.

Power automate desktop

🎯 Real-World Use Case

Let’s say you're running a legacy desktop app daily using Power Automate Desktop. Most days, it works fine. But occasionally, Windows throws a popup like:

Now, if the flow doesn’t respond, it halts. Not ideal, right? We’ll fix that today.

🧰 Tools Needed

⚙️ Step-by-Step Guide

🧱 Step 1. Launch the EXE

Use the “Run application” action to launch your .exe file.

Action: Run the application

Path: "C:\Program Files (x86)\Calculator\calculator.exe"

🔄 Step 2. Add a Monitoring Loop

Add a loop to continuously check for popups during execution.

Repeat 10 times

This means it will run 10 times.

Loop

🔍 Step 3. Detect a Popup Window

Inside the loop, use the “If window” action to detect any unexpected window.

Windows

🧹 Step 4. Close the Popup

If such a window appears, use Send Keys or Click UI Element to close it.

Close the snipping tool with the selection of the UI element.

UI Element

Preview Selector,

> titlebar[Id="TitleBar"] > button[Id="Close"]

The flow will terminate the process if anything unexpected popup opens like this.

📌 Pro Tips

🙋 Conclusion

Random popups can ruin well-planned automation. But with the right detection and handling techniques in Power Automate Desktop, you can keep your flows running smoothly, no matter what pops up!

If this article helped you, don’t forget to share it or drop a comment. ✌️