Jump to content
Sign in to follow this  
decon8x

ControlClick work but wrong coord

Recommended Posts

decon8x

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:

Share this post


Link to post
Share on other sites
somdcomputerguy

Perhaps MouseClick and ControlClick use different defaults, so set this, MouseCoordMode (Option).


- 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
decon8x

Just tried but it same :mellow:

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
decon8x

so, what should i do to correct the coord ?

Share this post


Link to post
Share on other sites
decon8x

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:

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
decon8x

Aww, just checked, my fault lol :mellow:

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

Share this post


Link to post
Share on other sites
Tvern

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.

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  

×