Sign in to follow this  
Followers 0
CocaCola1131

Newbie Help About Mouseclick Function

8 posts in this topic

Hello,

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)
EndFunc

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.

Share this post


Link to post
Share on other sites



Welcome to the AutoIt forum. ;)

Please post the complete content of Autoit Window Info. (Summary)


Regards Autolaser

Share this post


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 <<<<
Class:
Instance:
ClassnameNN:
Name:
Advanced (Class):
ID:
Text:
Position:
Size:
ControlClick Coords:
Style:
ExStyle:
Handle:
>>>> 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.

Share this post


Link to post
Share on other sites

Where is the name of the window title? ;)


Regards Autolaser

Share this post


Link to post
Share on other sites

Where is the name of the window title? ;)

Is that important for the function? Guess not.

However I guess I found the solution already.

Thanks for not answering nothing lol.

Topic closed.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0