Jump to content

Pause until time of day


dickep
 Share

Recommended Posts

OK, I have an AutoIt app that does things. I want it to run every 5 minutes - that will include anything it does so as not to take up "extra" time.

I have tried a couple of things but cannot figure out how to add 300 seconds to _Now and then make a loop until that time happens.

Thanks in advance.

E

Link to comment
Share on other sites

You can place a sleep in the loop statement. For the trigger you need to be careful using the _NOW func because depending on when you start your script it could past the time you were checking for. Say you wanted the script to end a 5:00PM you could just use the @HOUR macro to check and exit on that. Many things you can do.

Link to comment
Share on other sites

You can place a sleep in the loop statement. For the trigger you need to be careful using the _NOW func because depending on when you start your script it could past the time you were checking for. Say you wanted the script to end a 5:00PM you could just use the @HOUR macro to check and exit on that. Many things you can do.

So one could NOT use a condition that if the "now time" is less than "trigger time", stop the looping?

I tried using _DateAdd("s", 40, _Now()) and could not then display the result. Maybe something amiss here??

Thanks

E

Link to comment
Share on other sites

So one could NOT use a condition that if the "now time" is less than "trigger time", stop the looping?

I tried using _DateAdd("s", 40, _Now()) and could not then display the result. Maybe something amiss here??

Thanks

E

You could use the logic, and it should work.

Can you post your script so we can see where the script may have an issue?

Link to comment
Share on other sites

$mWaitMsg = "Waiting.."
$tTriggerTime = 30
$tNewTime = _DateAdd("s", $tTriggerTime, _Now())
while _NowCalc() <= $tNewTime
                $mWaitMsg = $mWaitMsg & "."
    msgbox(0,"Pause..", $mWaitMsg, 1)
WEnd

MsgBox(0,"","Ended in 30 seconds"

Here is my snippet - hope it makes sense. I tried this and it does not seem to work -just, as with the energizer bunny, "just keeps on going and going and going......

Thanks

E

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...