boat_58 Posted December 18, 2018 Share Posted December 18, 2018 Is it possible to write a script to have it start at a specific time of the day or night? I am still learning this and i am hoping someone is able to help me. Instead of having it sleep in ms, i was hoping there was another command that would make it start at a specific time on my computer. Thanks in advance Link to comment Share on other sites More sharing options...
Subz Posted December 18, 2018 Share Posted December 18, 2018 Why not use task scheduler? You can use schtasks to configure the task. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 18, 2018 Developers Share Posted December 18, 2018 2 minutes ago, boat_58 said: i was hoping there was another command that would make it start at a specific time on my computer. I honestly would use the build-in windows scheduler for that. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 18, 2018 Moderators Share Posted December 18, 2018 @boat_58 the easiest way is to use the Windows Task Scheduler. Literally what the tool was made to do. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 18, 2018 Developers Share Posted December 18, 2018 mmm .. guess we agree? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ModemJunki Posted December 18, 2018 Share Posted December 18, 2018 I also agree that Task Scheduler is the most reliable/best way to have a task start at the same time every day. But for the sake of my own education I had a look at the perfectly good date/time macros in AutoIT, just in case you want your script to hang around doing not much until a certain time has come (say, 13 minutes past 1 in the afternoon), this much is simple. Do If @HOUR & ":" & @MIN = "13:13" Then ConsoleWrite(@HOUR & ":" & @MIN & @CRLF) ; write to console but could be any action really ExitLoop ; if we exit the loop it only runs once, remove if you want this to happen every day EndIf Sleep(1000) Until 0 But what if the time you specified in your code has already passed (such as the system was asleep)? Ok, just change the comparison operator so instead of "=" you use ">=", then it will trigger after the time has passed too. Really have a close look at Windows task scheduler (I'm looking at Windows 10) - you can set multiple triggers, you can define different conditions, you can define retry on failure (now, that looks interesting: how does the task schedule know a task has failed? What do we need in our script to assure this is properly working?), there is an history kept, etc.. The built-in scheduler is really pretty fail-safe once you have your task set up. Anyway someone tackled running tasks at set times a long time ago and there are good (simple) examples of using the Time and Date macros there, have a look, and best of luck! boat_58 1 Always carry a towel. Link to comment Share on other sites More sharing options...
boat_58 Posted December 18, 2018 Author Share Posted December 18, 2018 Thank you all for your response. 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