Share this post

Link to post

Share on other sites

mikell 610

mikell 610

It should be possible to get around the 10s max issue for the 'do something' task by the use of AdlibRegister, but if a new 'do something' starts while the previous one is still running this can lead to strange results ^^

Share this post

Link to post

Share on other sites

czardas 1,116

czardas 1,116

I don't think the OP knows exactly what he or she wants. There are several possibilities but it's pure guesswork. There are many ways to trigger events with the possibility of duplicated calls, interrupted processes, time catch up and time out scenarios. 'do something' every 10 seconds is just too vague to give a clear answer.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Share this post

Link to post

Share on other sites

czardas 1,116

czardas 1,116

I imagine using AdlibRegister will produce more or less the same set of results as the code posted by brewmanNH. There may be a small drift factor with both methods - I'm not sure. This will occur with BrewmaNH's method without any modification. Using the @Sec macro combined with TimerDiff and Sleep may be more accurate (approx 10 to 11 ms delay, but with no overall drift). I have no time now, but someone should be able to figure this out if need be.

Share this post

Link to post

Share on other sites

BrewManNH 1,038

BrewManNH 1,038

Lets be totally honest here, there's no way that AutoIt will EVER be able to give you something at an exact time consistently. There's going to be drift no matter what you use just because AutoIt is an interpreted language, and even the best personal computer is going to have some kind of clock drift just on its own. Hence the need for setting the clock using NTP servers on practically every OS.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Share this post

Link to post

Share on other sites

BrewManNH 1,038

BrewManNH 1,038

That will work, as long as the OP doesn't mind if the first run through isn't exactly 10 seconds after starting the script. Because if the first run is started at 11 seconds, the consolewrite happens 9 seconds later, if the first run is started at 9 seconds, the consolewrite will happen 1 second later.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Share this post

Link to post

Share on other sites

kylomas 407

kylomas 407

That will work, as long as the OP doesn't mind if the first run through isn't exactly 10 seconds after starting the script. Because if the first run is started at 11 seconds, the consolewrite happens 9 seconds later, if the first run is started at 9 seconds, the consolewrite will happen 1 second later.

Share this post

Link to post

Share on other sites

czardas 1,116

czardas 1,116

That will work, as long as the OP doesn't mind if the first run through isn't exactly 10 seconds after starting the script. Because if the first run is started at 11 seconds, the consolewrite happens 9 seconds later, if the first run is started at 9 seconds, the consolewrite will happen 1 second later.

Judging by the first post this would be the case. Some additional maths can be thrown in to make small adjustments to the timing. This is a method without drift.