Sign in to follow this  
Followers 0
wangzhengbo

What is the meaning of MouseClickDownDelay option?

11 posts in this topic

The default value for MouseClickDownDelay is 10 milliseconds.

Is it means after call AU3_MouseDown it will delay 10 milliseconds?

Share this post


Link to post
Share on other sites



I believe that it is how long the mouse button will be held down.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

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


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

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?

Share this post


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

Share this post


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

Share this post


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.

Share this post


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.

Share this post


Link to post
Share on other sites

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.

Yes, that would indicate a bug. Post it using the Bug Tracker linked at the top of the forum.

Share this post


Link to post
Share on other sites

Oh wow, derp. Good catch Jon. I didn't even bother reading the posted code because I assumed MouseClick was used.

1 person likes this

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0