Jump to content

Recommended Posts

Posted (edited)

Hi there,

I did a short script to simulate mouse click when pixel change is detected on a small section of the screen. I recorded the screen many times to see the accuracy of the script and it seems though response time varies widely.

Here's the script 

$checksum = pixelchecksum (400,250, 402,252)

While $checksum = pixelchecksum (400,250, 402,252)

Sleep (50)

Wend

Sleep (300)

Mouseclick("left", 450,300, 1, 0)

Counting from the pixel change to the mouse click, i get response times anywhere between 370ms and 550ms. I've tried running au3 and exe, changed sleep times but never gotten an accurate response time based on the script. Any ideas why?

Edited by lacamel
Typo
Posted (edited)

When I completely delete the first sleep from the pixelchecksum loop, response time is more consistent. CPU load is minimal.

However, if I set sleep at say 500 ms in the pixelchecksum loop, time lag varies between 150 and 600 ms. How can it be that sleep time is significantly shorter than the value set in this case?

Edited by lacamel
Typo
Posted

How are you determining the length of time?

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 Gude
How 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.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

  • 2 weeks later...
Posted (edited)

Good question. I used high res video capture of the screen. 

I also noticed that setting the computer in high performance mode helped the accuracy but still getting 50-100 ms  differences. Might be having a processing power issue

Edited by lacamel
Typo
Posted

Good point Danp2, but a 50ms sleep in the loop does not explain a 100ms lag or more. Eliminating the sleep from the loop does not change that either

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...