Jump to content
keys24

ControlClick not working when using AutoItX3

Recommended Posts

I am running a few simple tests and when using AutoItX3 from the .NET library, ControlClick is not clicking.

Here is what I am doing:

// C#
var autoIt = new AutoItX3();
autoIt.Sleep(2000);
autoIt.WinActivate("Untitled - Paint", "");
autoIt.ControlClick("Untitled - Paint", "", "", "LEFT", 1, 500, 500);

The window does activate, but the click never happens. When I run a .au3 script with the same code, on the same machine, it _does_ work. 

; Autoit Script
Sleep(2000)
WinActivate("Untitled - Paint", "")
ControlClick("Untitled - Paint", "", "", "left", "1", 500, 500)

 

Any ideas on what else I might need to do so this work from .NET land? This feels like a bug somewhere in AutoItX3. 

 

Thanks!

Share this post


Link to post
Share on other sites

Thanks for the reply. 

Unfortunately, "left" also does not work. I was hopping to click at the x,y in the window, not specifically on any control. Maybe that is poor use of this API - however, it works when using an .au3 script vs c#. 

To workaround this, I have instead used MouseMove with the CoordMode set to relative of the window. I'd still like to know why the C# API does not work for ControlClick - that feels like a bug. 

Share this post


Link to post
Share on other sites

use AU3_MouseClick(), and it works well. I test it in java.

Below is the java code:

import cn.com.jautoitx.Misc;
import cn.com.jautoitx.Mouse;
import cn.com.jautoitx.Opt;
import cn.com.jautoitx.Opt.CoordMode;
import cn.com.jautoitx.Win;

public class Test {
    public static void main(String[] args) {
        Misc.sleep(2000);

        Opt.setMouseCoordMode(CoordMode.RELATIVE_TO_ACTIVE_WINDOW);
        Win.activate("Untitled - Paint", "");
        Mouse.click("LEFT", 200, 200, 1);
    }
}

The autoitx java library downloaded from http://sourceforge.net/projects/jautoitx/files/

 

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

×
×
  • Create New...