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
Answered

Desktop Flow loop

(0) ShareShare
ReportReport
Posted on by 6

Is there a way to set a loop to stop at a certain time?
At the moment, I have two loops that has pauses and loop index X times which then equals 12 hours, but I was wondering if there's an easier way to set it to stop at certain time.

Problem I'm facing is I have two flows "enable" and "disable". Because they run on fixed hours (pauses and loop index)  to complete the flow, if it fails and I restart the flow, it won't care if "enable' flow was meant to start at 9am because the disable flow was still in loop. or vice versa.
I did look at scheduling but because I need it to run on a machine rather than from cloud flow that's why I need to use desktop flow. 

What i'm waiting to acheive is enable flow runs at 8:53am UTC, runs loop to open web browser, click around (So web browser doesn't close due to inactivity) every 10mins, TILL the disable flow starts at 5pm, runs loop to open web browser, click around (So web browser doesn't close due to inactivity) every 10mins, repeat enable flow runs at 8:53am next morning and so on.


Thank you in advanced!

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Do you have a Power Automate Premium license? If you do, you could use cloud flows or Windows Task Scheduler to schedule your flows. If you do not, then there is no scheduling available.

     

    There is no way to stop a flow at a certain time. What you have built is essentially what it is. You would just need to keep checking what time it is (using the Get current date and time action) and stop when it reaches a certain time.

    -------------------------------------------------------------------------

    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

     

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Will_H Profile Picture
    6 on at

    Hi Agnius,

    Thank you for your reply.
    I do have Automate Premium license, I have tried with cloud flow scheduling, but it just queues and waits till the existing flow is finished.

    Ok, I can look at get current date and time action and stop when it reaches certain time.
    Could you please give an example of using get current date and time to stop at 5pm?
    I've tried researching but most don't mention how to apply the action to a specific time.

    Thank you in advanced 

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    When you use the Get current date and time action, the result is usually a date time variable stored in %CurrentDateTime%. It has various properties, using which allows you to retrieve parts of the date, such as the month, the day, the hour, etc. So, you can do an If statement to check if %CurrentDateTime.Hour% is greater than or equal to 17 (5PM) and then use Exit loop to stop looping when that's true.

     

    It would look somewhat like this:

    Agnius_0-1693915068071.png

     

    Make sure your Get current date and time action is inside the loop, so that you actually get an updated timestamp, and not just keep checking the same value over and over again.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

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 997

#2
Valantis Profile Picture

Valantis 810

#3
Haque Profile Picture

Haque 642

Last 30 days Overall leaderboard