Sign in to follow this  
Followers 0
krzyrice

Sleep Inaccuracy

7 posts in this topic

Hi I've done some research on the forums on how to get more precise sleep times (down to the millisecond). Basically, I have a very simple script that does something like this:

Send("{SPACE}")
Sleep(120)

and looping

It seems like someone has found a solution, but I have no idea how to incorporate it into my script. Can anyone help me out?

Solution

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi I've done some research on the forums on how to get more precise sleep times (down to the millisecond). Basically, I have a very simple script that does something like this:

Send("{SPACE}")
Sleep(120)

and looping

It seems like someone has found a solution, but I have no idea how to incorporate it into my script. Can anyone help me out?

Solution

:D You are dealing with milliseconds (Your example shows 120 milliseconds).

How much more precise are you looking at getting? There were some options that were shown in the example forum a while back that did it in nanoseconds I believe, but they didn't work on Vista/Win7 ( or maybe it was x64, can't remember ) I believe.

Edit:

Found the link:

http://www.autoitscript.com/forum/index.php?showtopic=77905

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

How much more precise are you looking at getting? There were some options that were shown in the example forum a while back that did it in nanoseconds I believe, but they didn't work on Vista/Win7 ( or maybe it was x64, can't remember ) I believe.

Believe me, they DO work. I use them all the time. Win7 x64.

Share this post


Link to post
Share on other sites

Hi thanks for that link. I still don't know how to incorporate it into my script though. How would I replace the simple sleep(x) with the more precise sleep? Here is what my script looks like.

1Global $Paused
HotKeySet("{F9}", "Pause")
HotKeySet("{F8}", "Spam")
HotKeySet("{F12}", "End")

While 1
    Wend

Func Spam()
    While 1
Send("{SPACE}")
Sleep(970)
Send("{SPACE}")
Sleep(820)
Send("{SPACE}")
Sleep(5000)
    Wend
EndFunc

Func Pause()
while 1
sleep(100)
wend
endfunc 
  
Func End()
Exit
EndFunc

Share this post


Link to post
Share on other sites

Just curious, but when would you use a nanosecond test.

Imagine it need to be a relative short test, or the multi tasking OS is going to mess with your results.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

can anyone help me?

Edited by krzyrice

Share this post


Link to post
Share on other sites

can anyone help me?

You seriously think anyone wants to help you with a function called spam? We get enough of that without helping people that can't figure out how to implement functions that are spelled out for them.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0