Sign in to follow this  
Followers 0
dickep

Pause until time of day

8 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

This wont work?

Do
Sleep(100)
Until @Hour = 18 AND @MIN = 31
Msgbox(0, "Time", "It's 5:30!")
Yes that will work, I changed the time and it worked on my system. Same thing but using a variable to hold the time:

Do

$t = @HOUR &":"& @MIN

Sleep(5000)

Until $t > "18:30"

Edited by rmarino

Share this post


Link to post
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
Sign in to follow this  
Followers 0