Jump to content
Sign in to follow this  

Mouse position incorrect

Recommended Posts


I tried to send keystroke using controlsend(no problem) and controlclick(problem) to a gamewindow but seems like the mouse click on the wrong position. I'm using AutoIt Window Info to get the position. There must be something wrong. Need advice..

Sample of my code:

Opt("CaretCoordMode", 0) ;1=absolute, 0=relative, 2=client
Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client

Global $X[6] = [792, 831, 869, 906, 944, 981]
Global $Y1 = 125
Global $Y2 = 166
Global $Y3 = 201
Global $Y4 = 237
Global $Y5 = 274
Global $Y6 = 315
Global $Y7 = 347
Global $Y8 = 387
Global $JX = 508
Global $JY = 508

$r1 = 0
            For $r1 = 0 To 5
                ControlClick("[CLASS:ZElementClient Window]", "", "", "right", 1, $X[$r1], $Y1)
                    ControlClick("[CLASS:ZElementClient Window]", "", "", "left", 1, $JX, $JY)
                Until (PixelGetColor(510, 513) == 0xA8A8A8)

Another question, under the option section on the AutoIt Window Info, there's an option Coord Mode, which should I chooose? Curently I'm using 'Window' option.

Pls. advice..


Edited by BitByte

Share this post

Link to post
Share on other sites

A lot of "gamewindows" have bot countermeasures, where they are designed to not expose information about colours and coordinates.

Also it will be difficult trying to ControlClick a Contol without giving the Control ID of the Control you are trying to ContolClick :mellow:

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

Several things.

try mouseclick instead of Controlclick and add the left and top pixels of the window to your co-ordinates in the window

It's picky, but this is redundant "$r1 = 0" :mellow:

You appear to be attempting to rightclick at 792 across, 125 down, then left click at 508 across and down until the pixel at 510 across, 513 down is a particular color, then repeat at various other points across on the 125 line. you don't appear to use the vast majority of your global variables. Is this intentional?

Failing all else, trial and error: you say its clicking on the wrong spot. Is it too high (subtract from y's) too low(add to y's) too far left(subtract from x's) or too far right(add to y's)

Edited by Remnant

Share this post

Link to post
Share on other sites

Got no problem when using mouseclick. The reason I want to use controlclick is because i want it to click even if the windows in unfocus/minimized.

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