Sign in to follow this  
Followers 0
thimker

SLEEP(14400000) = 4 hrs

5 posts in this topic

I don't know enough to say how much CPU load is needed to use SLEEP() for long intervals, e.g., 4 hours. Is there a simple but less demanding way to do this. I thought about trying @HOUR and watching until the value changes by specified integer, but putting that in a WHILE loop would also take a lot of CPU ticks. I'd like to run a program at n-hour intervals or at specific hours. Perhaps one could use SELECT CASE, but how to run program only once each time? // thnx

[i could not come up with good terms for SEARCH.]

Share this post


Link to post
Share on other sites

You could always think about taking the running of the program every n-hours out of the script all together. There are programs already designed to do this, such as the Windows Scheduler.

Share this post


Link to post
Share on other sites

I don't know enough to say how much CPU load is needed to use SLEEP() for long intervals, e.g., 4 hours. Is there a simple but less demanding way to do this. I thought about trying @HOUR and watching until the value changes by specified integer, but putting that in a WHILE loop would also take a lot of CPU ticks. I'd like to run a program at n-hour intervals or at specific hours. Perhaps one could use SELECT CASE, but how to run program only once each time? // thnx

[i could not come up with good terms for SEARCH.]

<{POST_SNAPBACK}>

I wondered the same thing when I wanted to run a monitoring script (an .exe) that would repeat Sleep(95 * 1000) ad infinitum. The machine is an XP Home, Athlon XP 2000. As a rough test, I shut down most processes to bring the resource meter's CPU Usage reading to a quiescent state. It oscillated slowly between 0% and 0.05%. The script running made no observable difference.

Share this post


Link to post
Share on other sites

When you're using bigger Sleep() values (AFAIR Jon mentioned something about >20 ms?) AutoIt just tells windows to wake it up in X milliseconds. So AutoIt doesn't use any CPU at that time. Windows is responsible for that.

This is of course IIRC and I'm no developer.

But whatever you're doing, you won't be able to do a less CPU consuming method written in AutoIt script.

Share this post


Link to post
Share on other sites

Thanks to all. Very reassuring.

"The easiest is the bestest" in this case.

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