Jump to content

Get system time


Recommended Posts

Hi. I am trying to figure out the best way to have a computer automatically restart every day at 3 or 4am. I have flash files running 24/7 which for some reason freezes just the flash and I am stuck manually restarting the computer to clear the memory and whatnot. I very much need this automated and would love to use autoit for this purpose.

I searched this forum over and over and I still can't seem to find a way for autoit to check the system time. Basically this is all I need (in laymans)

If Time = 04:00

shutdown(2)

end if

Any help is appreciated and I apologize if this has been posted before. Thanks.

Link to comment
Share on other sites

I use this when I want to shutdown my computer at night:

Do
    Sleep(1000)
Until @HOUR=4 AND @MIN=00
Shutdown(2)

Oh and welcome to the forum btw! :)

Hi and Thanks! Can't wait to try it out right now. Just so I understand it though, the sleep command is just a filler so the script can keep checking the time? Then once the time matches up it shuts down. Do I have this right? Thanks again and I'll let you know how I make out.

Link to comment
Share on other sites

Hi and Thanks! Can't wait to try it out right now. Just so I understand it though, the sleep command is just a filler so the script can keep checking the time? Then once the time matches up it shuts down. Do I have this right? Thanks again and I'll let you know how I make out.

the sleep command is there to prevent the script from continuously checking the system time. It will wait the specified amount of time before checking the system time again.

Prevents the script from constantly hogging processor time :)

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Hi - Just wanted to say thanks for the help. I have exactly what I need to get the computer to restart every day at 4am. Here is the code that I used:

Do
    Sleep(5000)
Until @HOUR=4 AND @MIN=00
Sleep(60000)
Shutdown(2)

The reason why I have it to wait one minute before rebooting is because when the computer restarted immediately it is still 4am and I have this script running at startup which means it reboots again.

Thanks again!

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...