Jump to content

ControlClick work but wrong coord


Recommended Posts

Please look the code below

Func StartButton()
$coord = PixelSearch (0, 0, 1440, 900, 0x7D5347 )
If Not @error Then
    Sleep (1000)
    MouseClick ("left", $coord[0], $coord[1] )
EndIf
EndFunc

This code work fine, the mouse is click right coord. But when i try ControlClick as below

Func StartButton()
$coord = PixelSearch (0, 0, 1440, 900, 0x7D5347 )
If Not @error Then
    Sleep (1000)
    ControlClick ("Untitled - Google Chrome", "", "[CLASS:NativeWindowClass; INSTANCE:1]", "left", $coord[0], $coord[1])
EndIf
EndFunc

It's work too but the mouse click wrong coord, please help :mellow:

Link to comment
Share on other sites

The coordinates in ControlClick() are relative to the control itself. It only indicates where inside the control to click (the default is the center of the control). This is not affected by any of the Opt() settings.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Everybody please help, i have search and read around but did not find any helpful. I'm wondering what ControlClick() can do while it click wrong coord even after extract coord is added :mellow:

You want to try and look at the helpfile for ControlClick, specifically the params, because you are doing it wrong.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Aww, just checked, my fault lol :mellow:

Anybody know how to get ControlClick Coord like PixelSearch as i've said on 1st post?

Do you just want to click the control, because that means you don't have to specify coords at all.

If you want to click the control in a specific location, then you could get the coordinates of the control and calculate the relative coordinates that way, but in that case there is little reason for using controlclick in the first place unless the window is and should stay partially obstructed.

In short: just remove the coordinates all together.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...