Jump to content

What is the meaning of MouseClickDownDelay option?


Recommended Posts

And after a look in the Help file, here's the quote - Alters the length a click is held down before release.

 

I can't understand the note "Alters the length a click is held down before release." in the help file.

Is it means when i run something like below:

var startTime = getTime();

AU3_MouseDown();

var endTime = getTime();

then (endTime - startTime) >= 10?

Link to post
Share on other sites

It works like this.

1. AutoIt simulates pushing the mouse button down

2. AutoIt waits MouseClickDownDelay milliseconds

3. AutoIt simulates letting the mouse button back up

 

See example below:

import java.io.File;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.WString;

public class MouseDownDemo {
    public static void main(String[] args) {
        System.load(new File("AutoItX3.dll").getAbsolutePath());
        AutoItX autoItX = (AutoItX) Native.loadLibrary("AutoItX3",
                AutoItX.class);

        System.out.println("Default value for MouseClickDownDelay is: "
                + autoItX.AU3_Opt(new WString("MouseClickDownDelay"), 10));

        long start = System.currentTimeMillis();
        autoItX.AU3_MouseDown(new WString("left"));
        long end = System.currentTimeMillis();
        autoItX.AU3_MouseUp(new WString("left"));
        System.out.println("end - start = " + (end - start));
        System.out.println();

        // Change MouseClickDownDelay to 1 second
        System.out.println("Previous value for MouseClickDownDelay is: "
                + autoItX.AU3_Opt(new WString("MouseClickDownDelay"), 1000));

        start = System.currentTimeMillis();
        autoItX.AU3_MouseDown(new WString("left"));
        end = System.currentTimeMillis();
        autoItX.AU3_MouseUp(new WString("left"));
        System.out.println("end - start = " + (end - start));
        System.out.println();

        // Change MouseClickDownDelay to 2 seconds
        System.out.println("Previous value for MouseClickDownDelay is: "
                + autoItX.AU3_Opt(new WString("MouseClickDownDelay"), 2000));

        start = System.currentTimeMillis();
        autoItX.AU3_MouseDown(new WString("left"));
        end = System.currentTimeMillis();
        autoItX.AU3_MouseUp(new WString("left"));
        System.out.println("end - start = " + (end - start));
        System.out.println();
    }

    protected static interface AutoItX extends Library {
        public void AU3_MouseDown(WString button);

        public void AU3_MouseUp(WString button);

        public int AU3_Opt(WString option, int value);
    }
}

The output is:

Default value for MouseClickDownDelay is: 10
end - start = 0
 
Previous value for MouseClickDownDelay is: 10
end - start = 0
 
Previous value for MouseClickDownDelay is: 1000
end - start = 0
 
The AU3_MouseDown dose not delayed.
You can download MouseDownDemo.zip, it's contains all libs and src to run MouseDownDemo, it can be imported to eclise.

MouseDownDemo.zip

Link to post
Share on other sites

I believe that is because AutoIt internally does a Sleep(delay) and sleep of ten milliseconds is unreliable at best. Windows may be optimizing it out.

 

I think this is a bug in AutoItX. Because i changed the MouseClickDownDelay to 2000 milliseconds, and there is no delay in AU3_MouseDown too.

Link to post
Share on other sites
  • 6 months later...

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...