Synct Posted September 11, 2010 Posted September 11, 2010 Im looking to adjust the speed at which a script plays. say you have a script that runs on several machines, some slower than others, Is there a way to have a global sleep between each line instead of having to type "Sleep (1000)" Between every line of a 7,000 line program?Basically to have the same result asMouseClick("left",512,317,1)Sleep(1000)MouseClick("left",283,321,1)Sleep(1000)MouseClick("left",329,645,1)Sleep(1000)Send("{ENTER}")Sleep(1000)MouseClick("left",582,362,1)Sleep(1000)MouseClick("left",275,321,1)Sleep(1000)MouseClick("left",326,644,1)Sleep(1000)Send("{ENTER}")Sleep(1000)MouseClick("left",324,302,1)Sleep(1000)And so on...Thanks in advance!
Spiff59 Posted September 11, 2010 Posted September 11, 2010 Take a look at Adlibregister(0 in the help file.
maqleod Posted September 11, 2010 Posted September 11, 2010 (edited) Why do you need to sleep after every line? There are functions like WinWait(), WinWaitActive() and WinWaitClose() that might be better suited, as they'll work for any speed computer You can also look at the WinWaitDelay setting too. Edit: You might also find the ControlClick() function more useful, as it would be better suited for different resolutions (i mention this because you bring up using this script on different computers). Edited September 11, 2010 by maqleod [u]You can download my projects at:[/u] Pulsar Software
Synct Posted September 11, 2010 Author Posted September 11, 2010 Why do you need to sleep after every line?There are functions like WinWait(), WinWaitActive() and WinWaitClose() that might be better suited, as they'll work for any speed computerYou can also look at the WinWaitDelay setting too.Edit: You might also find the ControlClick() function more useful, as it would be better suited for different resolutions (i mention this because you bring up using this script on different computers).Because each action takes place in the same window, within a flash environment, so a delay is required because each action needs time to process and change the display. Using the auto recorder it makes one action happen directly after the last one finishes, so the action before is still processing within the web browser when the second action executes, which is supposed to happen on the form the first action opened.Hope that made sense.
maqleod Posted September 11, 2010 Posted September 11, 2010 Is this by chance a game bot? It is starting to sound like one. [u]You can download my projects at:[/u] Pulsar Software
Synct Posted September 11, 2010 Author Posted September 11, 2010 (edited) No it is a database bot that changes values for each employee from a table, it automatically searches by name, on an ftp server, when a name is selected it displays basic info about the employee and how to contact them, the worst part is it is very repetitive in changing values and sending out "memos" ive been pestering them to use a more modern method but my boss is very picky when it comes to changing things, afraid it will mess things up, so until then this is all ive got, originally I was trying to develop a GUI through C# to accomplish it in much fewer steps, just giving this a shot as ive been pretty familiar with it. Using slower computers it takes time for each page to load, so I am looking for a wait to set a speed at which it runs, a delay between each command, 1000 on faster computers, as high as 5000 for the slower ones. I will be in front of it while it is running so if anything does go wrong I can pause it and do it manually. Edit:Typo Edited September 11, 2010 by Synct
maqleod Posted September 11, 2010 Posted September 11, 2010 Well, PixelSearch() might help, you can do the mouse click when the button you need to press actually appears, that way you won't need to sleep. [u]You can download my projects at:[/u] Pulsar Software
Synct Posted September 11, 2010 Author Posted September 11, 2010 Well, PixelSearch() might help, you can do the mouse click when the button you need to press actually appears, that way you won't need to sleep.That would help in some areas, thanks, What im looking for though would be perhaps a Global that would set the speed the executable runs. If this isn't possible I see it as being very helpful for a possible update in the future, would make it easier for computers with slower processors to rake the same results from autoit as those with newer machines, if unspecified it will run at the default speed.(no pause between actions)
Tvern Posted September 11, 2010 Posted September 11, 2010 If you are using sleeps in your script I often find it usefull to add a modifier to it. So instead of Sleep(1000), I would use Sleep(1000*$Speed). By changing the value of $Speed I can then easily tweak the speed. I don't think there is another way to slow down the execution of scriptlines other than putting sleeps in between.
Synct Posted September 11, 2010 Author Posted September 11, 2010 If you are using sleeps in your script I often find it usefull to add a modifier to it. So instead of Sleep(1000), I would use Sleep(1000*$Speed). By changing the value of $Speed I can then easily tweak the speed.I don't think there is another way to slow down the execution of scriptlines other than putting sleeps in between.Yea seems that way, I haven't found any other ways, still think it would be a good option to add at compile time for slower machines.
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