cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
heliox
New Member

How do I get my Desktop Automation to wait for a .bat or python script that takes ~ 10s to return before continuing?

I have a .bat script that is transcoding video using ffmpeg. This takes around 10 seconds. When I call one of the DOS, Powershell, Python script controls they all return instantly. What am I doing wrong? Building in specific Waits into the flow isn't trustworthy. Thanks.
2 REPLIES 2
tc_procare
Frequent Visitor

I would try "Get Window" (for the script window) and then "Wait for Window Content" on the new script window, if you are able to implement a text out at the end of your script to show something unique like 'Exit Code 0' to act as a visual handshake for the flow to see.

VJR
Super User
Super User

Hi @heliox 

Multiple ways to achieve it. One of them is as below.

You can use Wait but in a different way.

 

Can you add an output to the .bat or python script such that it writes something to a text file after its work is done? Eg: "Process complete"

If so, then then after calling the script from PAD, you can add a loop such that it waits for every 5 or 10 secs to check if there is some text written in the text file. If not found then continue the loop. If found then the job is done. Need to add a counter for the "number of retry attempts" that the loop will continue else there are chances that it may go in an infinite loop.

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Top Solution Authors
Top Kudoed Authors
Users online (2,724)