MajSlayer420 Posted January 30, 2007 Share Posted January 30, 2007 Hello I wanted to know if anyone knew how to make a timer to call a function at a certian time? Say I enter 11:00(military time please) into a input, how can I get my program to detect when this time has arrived then call a function? Thanks MajSlayer420 Link to comment Share on other sites More sharing options...
lod3n Posted January 30, 2007 Share Posted January 30, 2007 It would be better to use Windows Scheduled Tasks, and have it call a script that does the shutdown at a certain time. Otherwise, your script has to run continuously until the time arrives. Unless you have special circumstances that necessitate having a script run constantly, that's the way to go.Now, as to scripting the startup of the computer... that's been discussed before:http://www.autoitscript.com/forum/index.php?showtopic=31067 [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
MajSlayer420 Posted January 30, 2007 Author Share Posted January 30, 2007 Yes I do plan on running the script 24/7, I found some code that I figure might work if I implement it into my main loop. #include <Date.au3> While 1 If _NowTime(4) = "21:31" Then ; added the 4 parameter, to exclude the seconds(i dont think if you wake one second later makes any difference ) MsgBox(0,"wake","up") EndIf Sleep(100) WEnd Will this work? Thanks for the reply MajSlayer420 Link to comment Share on other sites More sharing options...
lod3n Posted January 30, 2007 Share Posted January 30, 2007 No, because your sleep is too short. It will call the function many times during 21:31. Make your sleep= Sleep(60*1000) so it waits a full minute before testing the time again. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] 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