Jump to content

Newbie Help About Mouseclick Function

Recommended Posts


I'm currently trying to improve an AutoIt script I got from an open source.

However I'm having troubles understand well the function MouseClick and PixelSearch.

The MouseClick basic function seams simple.

MouseClick("button" [,x, y [,clicks [,speed]]])

However in this script it's inserted in a function/variable and they are some maths done with the Window/Client that I'm not understanding fully.

Can we do calculations of the values X and Y based on the resolution of the application window?

I will copy part of the code.

Global $windowcurrent

$windowcurrent = WinGetPos("[CLASS:ApolloRuntimeContentWindow]")

ClickClient("left", 190, 475, 230, 480)

Func ClickClient($button, $x, $y, $x1, $y1)
MouseClick($button, ((($windowcurrent[2]/1024)*Random($x, $x1))+$windowcurrent[0]), ((($windowcurrent[3]/640)*Random($y, $y1))+$windowcurrent[1]), 1, 0)

The application window have 1024x640 resolution. The deskopt resolution it's 1024x768

I was able to find the $x and $y values using the AutoIt window Info, but I still didn't get the $x1 and $y1 values.

Plus the maths *Random ?

Does anyone know what is behind of this. I just want to do a simple mouseclick on the window client.

Thanks in advance.

Link to post
Share on other sites

Thank you for the welcome message.

I hope to make not so many posts here, means that I understood well your wiki ;)

As requested.

Class: ApolloRuntimeContentWindow
Position: 0, 64
Size: 1024, 640
Style: 0x16CB0000
ExStyle: 0x00040100
Handle: 0x000500B6
>>>> Control <<<<
Advanced (Class):
ControlClick Coords:
>>>> Mouse <<<<
Position: 190, 455
Cursor ID: 0
Color: 0x313131
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<

>>>> Hidden Text <<<<

The only thing I guess could be it's that this function could handle two different desktop resolutions.

If Desktop 1024x768 then uses values x,y

If Desktop 1280x800 then uses values x1,y1

Since I always use 1024x768 I guess I could remove all the extra code.

Link to post
Share on other sites

MouseClick and PixelSearch. + [CLASS:ApolloRuntimeContentWindow]

I have therefore asked for the window title, because I think that here you are trying to automate a game.

Your answer to that tells me that this is the case.

If you look through reading the forum rules, you'll find you here, you are not going to get help for your Gamebot.

Mods please close this topic Gamebot.

Edited by Autolaser

Regards Autolaser

Link to post
Share on other sites

you could use the WinGetClientSize and store it into a variable. example:

$Size = WinGetClientSize("Notepad")
MouseClick("Left", $Size[0], $Size[1])

if the area u r trying to click is anchored to a side of the window, you can add or subtract pixels from the $Size.

Link to post
Share on other sites
  • Moderators

Topic closed.

Game automation is against the forum rules.

You're correct to assume this topic is closed, but you will need to refrain from posting anything about such topics again.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...