mcfr1es Posted August 9, 2004 Share Posted August 9, 2004 (edited) Ok, well, I just started using autoit and I began writting small scripts to help me learn a little more about the language. Unfortunately, one of my scripts has a problem. Here is part of the script: While 1 Send("{SPACE down}") Send("{RIGHT down}") sleep(x) Send("{SPACE up}") Send("{RIGHT up}") Send("{SPACE down}") Send("{LEFT down}") sleep(x) Send("{SPACE up}") Send("{LEFT up}") WendThe x values in this script seem to be irrelevant as i tried changing their value to anything from 0 to 1000000 and the pause seems to be the same whatever their value is. Any help?EDIT: The x values are not in quotes...EDIT2: my sleep values are not intergers.... they are just numbers (ie. 2000)and whatever i substitute into x the pause remains the same I even tried using Sleep(0) and it pauses just as long as Sleep (1000000) does. Edited August 9, 2004 by mcfr1es Roger! You son of a big pile o' Monkey Nuts. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 9, 2004 Developers Share Posted August 9, 2004 (edited) The x values in this script seem to be irrelevant as i tried changing their value to anything from 0 to 1000000 and the pause seems to be the same whatever their value is. Any help? ] <{POST_SNAPBACK}>"x" is a literal/string which is the same as 0.. Try Sleep($x) Edited August 9, 2004 by Larry SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
pekster Posted August 9, 2004 Share Posted August 9, 2004 I don't know what you are trying to do, but I have created an example for you to observe and play with. It uses both a fixed sleep time (in the script this is 5 seconds) and a variable sleep time that uses a variable. You can change the variable sleep time that will affect how quickly the window is displayed and erased. I created this to help you see how to use Sleep() with a number, and Sleep() with a variable. Here is the code: SplashTextOn("Sleep example", "Sleep example AutoIt Program" & @LF &_ "This window will stay open for 5 seconds") Sleep(5000);5 seconds * 1000 milliseconds in 1 second SplashOff() HotKeySet("!q", "quit") MsgBox(0, "What to do", "Please read this. A splash text window will now "&_ "flash and dissepear on a timed basis."&@LF&"You can control the speed of "&_ "this with your keyboad. To make the delay longer, press alt+s"&@LF&"To "&_ "make the delay shorter, press alt+f"&@LF&"To Exit the script, press alt+q"&_ @LF&"All speed changes are in incriments of half a second. You cannot go "&_ "shorter than half a second, or longer than 10 seconds") HotKeySet("!s", "slower") HotKeySet("!f", "faster") Global $time = 1000 While 1 SplashTextOn("Sleep Window", "Current delay time is: " & $time) Sleep($time) SplashOff() Sleep($time) WEnd Func quit() Exit EndFunc Func slower() If $time < 10000 Then $time = $time + 500 EndFunc Func faster() If $time > 500 Then $time = $time - 500 EndFunc [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
ivan Posted August 9, 2004 Share Posted August 9, 2004 (edited) I had a brief look at your first line of code and I would suggest you declare and initialize a variable that you can use with while, say: While $var=1 blabla Wend Note that this iteration requires your variable $var to reach a non 1 value, otherwise it will keep looping forever. I often use the HotKeySet to build a function that allows me to interrupt the sript execution with a single key stroke if something goes wrong. Most my scripts include HotKeySet("{ESC}", "Terminator") code....... Func Terminator() Exit 0 EndFunc I must also agree that you are using the letter x, rather than the variable $x. hope this helps IVAN Edited August 9, 2004 by ivan Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now