krzyrice Posted January 13, 2010 Share Posted January 13, 2010 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 loopingIt 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 13, 2010 Moderators Share Posted January 13, 2010 (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 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 January 13, 2010 by SmOke_N 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. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 13, 2010 Share Posted January 13, 2010 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. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
krzyrice Posted January 13, 2010 Author Share Posted January 13, 2010 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 Link to comment Share on other sites More sharing options...
MvGulik Posted January 13, 2010 Share Posted January 13, 2010 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 ... Link to comment Share on other sites More sharing options...
krzyrice Posted January 13, 2010 Author Share Posted January 13, 2010 (edited) can anyone help me? Edited January 13, 2010 by krzyrice Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 13, 2010 Moderators Share Posted January 13, 2010 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. 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. Link to comment Share on other sites More sharing options...
Recommended Posts