CocaCola1131 Posted May 15, 2012 Posted May 15, 2012 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) EndFuncThe application window have 1024x640 resolution. The deskopt resolution it's 1024x768I 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.
Autolaser Posted May 15, 2012 Posted May 15, 2012 Welcome to the AutoIt forum. Please post the complete content of Autoit Window Info. (Summary) Regards Autolaser
CocaCola1131 Posted May 15, 2012 Author Posted May 15, 2012 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.
Autolaser Posted May 15, 2012 Posted May 15, 2012 Where is the name of the window title? Regards Autolaser
CocaCola1131 Posted May 15, 2012 Author Posted May 15, 2012 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.
Autolaser Posted May 15, 2012 Posted May 15, 2012 (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 May 15, 2012 by Autolaser Regards Autolaser
Kidney Posted May 15, 2012 Posted May 15, 2012 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.
Moderators SmOke_N Posted May 16, 2012 Moderators Posted May 16, 2012 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.
Recommended Posts