Lahtin3n Posted June 11, 2012 Share Posted June 11, 2012 Right, so I'm pretty new with AutoIt and I've been fooling around for a bit trying different things. I am currently trying to make the mouse follow a specific object on the screen, a ball to be more precise. I figured that I could use PixelSearch to define the coords and MouseMove to get the pointer to go there. The only problem is that the ball shifts in color, making it rather hard for me to figure out how to solve it. This is the basic script I tried using at first, and it had a rather low successrate as it many of the times could not find the correct color in time. While 1 $coord = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x14007F, 10) If Not @error Then MouseMove ($coord[0], $coord[1], 1) EndIf WEnd The background is static, and the only thing moving is the ball. Would it be possible to define a section on the screen, and use some sort of function to check for changes of pixels in that section? What function(s) should I be looking into? Link to comment Share on other sites More sharing options...
jdelaney Posted June 11, 2012 Share Posted June 11, 2012 If you know the pixel color, and the window area, it's very easy to do a PixelSearch to find the first instance of that color, and returned is the x/y to use in the mousemove. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
water Posted June 11, 2012 Share Posted June 11, 2012 (edited) As you are just fooling/playing around with AutoIt I would suggest to look for a real life problem and try to solve it.Threads where Pixelsearch is discussed/needed to solved a problem get locked very often.I assume you have read the forum rules and know that game automation isn't supported here? Edited June 11, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Lahtin3n Posted June 11, 2012 Author Share Posted June 11, 2012 (edited) If you know the pixel color, and the window area, it's very easy to do a PixelSearch to find the first instance of that color, and returned is the x/y to use in the mousemove.Well, I know. But as I said - the balls color is not constant As you are just fooling/playing around with AutoIt I would suggest to look for a real life problem and try to solve it.Threads where Pixelsearch is discussed/needed to solved a problem get locked very often.I assume you have read the forum rules and know that game automation isn't supported here?This is not for a game, this is for following an object in my browser with the mouse.It looks quite a bit like this, http://www.ericj.se/ (but instead of dragging the site with ur mouse, you move it with the arrows) and I wan't the mouse to follow an object like the lens flare in this example, except the color is not constant.Why do I want to do this? Well - because I want to learn how to do it, if it's even possible.I am not discussing PixelSearch, as I already stated that I won't be using that. I am merely asking for advice of what functions to read more about, as there are plenty of them in the documentation.Also, what's wrong with fooling around with AutoIt? I tend to do that when I am about to learn things, learning by doing you know.Don't be so quick at juding others please, as everything is not everytime what it might look like. Edited June 11, 2012 by Lahtin3n Link to comment Share on other sites More sharing options...
jdelaney Posted June 11, 2012 Share Posted June 11, 2012 same difference, as long as the color is consistantly changing between known value(s), and those values are not found on the rest of the area, you can find it consistantly. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Lahtin3n Posted June 11, 2012 Author Share Posted June 11, 2012 (edited) same difference, as long as the color is consistantly changing between known value(s), and those values are not found on the rest of the area, you can find it consistantly.Oh thanks, I got all stuck in my thinking. After reading this I figure I could be using an 'if-else' statement! Cheers. Edited June 11, 2012 by Lahtin3n Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now