dickep Posted February 15, 2008 Share Posted February 15, 2008 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 More sharing options...
rmarino Posted February 15, 2008 Share Posted February 15, 2008 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 More sharing options...
dickep Posted February 15, 2008 Author Share Posted February 15, 2008 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??ThanksE Link to comment Share on other sites More sharing options...
rmarino Posted February 15, 2008 Share Posted February 15, 2008 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??ThanksEYou 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 More sharing options...
Paulie Posted February 15, 2008 Share Posted February 15, 2008 This wont work? Do Sleep(100) Until @Hour = 18 AND @MIN = 31 Msgbox(0, "Time", "It's 5:30!") Link to comment Share on other sites More sharing options...
dickep Posted February 15, 2008 Author Share Posted February 15, 2008 $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 More sharing options...
Achilles Posted February 15, 2008 Share Posted February 15, 2008 Adlibenable("_FiveMinuteFunction", 5 * 60 * 1000) While 1 Sleep(20) WEnd Func _FiveMinuteFunction() Msgbox(0, 'Time', 'Five minutes passed.', 2) EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
rmarino Posted February 15, 2008 Share Posted February 15, 2008 (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 February 15, 2008 by rmarino Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now