Justforfun Posted July 18, 2010 Share Posted July 18, 2010 Hello, I have made a gui that is a 120x120 pixel square is there away to pixel search with in the square only so when I move it it will pixel search where I put the square instead of having locked pixel search coords. Any Idea's Link to comment Share on other sites More sharing options...
JohnOne Posted July 18, 2010 Share Posted July 18, 2010 (edited) PixelCoordMode option << helpfile edit: Infact there is a parameter for defining which window to search in the pixelsearch function. Edited July 18, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Justforfun Posted July 18, 2010 Author Share Posted July 18, 2010 (edited) PixelCoordMode option << helpfileedit:Infact there is a parameter for defining which window to search in the pixelsearch function.Ok I will look again mabye I missed it on the coord mode Opt("PixelCoordMode", 3) would be for the client window yes?I seen where it says you can select window handle to search but not sure exactly how to set left top right bottom coords for the window if I am going to be moving it. Edited July 18, 2010 by Justforfun Link to comment Share on other sites More sharing options...
Theri Posted July 18, 2010 Share Posted July 18, 2010 Use WinGetPos to find the current location of your window and then update the coords for your pixelsearch accordingly. Link to comment Share on other sites More sharing options...
JohnOne Posted July 18, 2010 Share Posted July 18, 2010 (edited) I think Opt("PixelCoordMode", 2) for the clent area of the window, and you also have to define that window in the pixelsearch function. Your top left coords will always be 0,0 . Edited July 18, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Justforfun Posted July 18, 2010 Author Share Posted July 18, 2010 Use WinGetPos to find the current location of your window and then update the coords for your pixelsearch accordingly.PixelSearch ask for PixelSearch( Left, Top, Right, Bottom, Color, Shade, Step, Handle)Where WinGetPos(Handle, Text) Returns X, Y, Width, and Height, so how would I enter left top right bottom with only Knowing left and top from wingetpos. Link to comment Share on other sites More sharing options...
Justforfun Posted July 18, 2010 Author Share Posted July 18, 2010 I think Opt("PixelCoordMode", 2) for the clent area of the window, and you also have to define that window in the pixelsearch function.Your top left coords will always be 0,0 .Its not 3 I think I said 3 I ment 2 thanks for the correction0 = relative coords to the defined window1 = absolute screen coordinates (default)2 = relative coords to the client area of the defined windowAlso If I set my sqaure top left to screens 0,0 then I can get the right and bottom for pixel search this is the part I am not understanding is how to set the right and bottom for my gui window is that correct. Link to comment Share on other sites More sharing options...
JohnOne Posted July 18, 2010 Share Posted July 18, 2010 left + width top + height AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Theri Posted July 18, 2010 Share Posted July 18, 2010 X and Y from WinGetPos are the top left coords for the window. Width and Height are the pixel width and height of the window. While 1 $pos = WinGetPos($mywindow) If @error Then MsgBox(0,"Error","Window not found.") EndIf $coords = PixelSearch($pos[0],$pos[1],($pos[0]+$pos[2]),($pos[1]+$pos[3]),$hex,$variation) If Not @error Then ;Found. ElseIf @error Then ;Not found. EndIf WEnd Link to comment Share on other sites More sharing options...
Justforfun Posted July 18, 2010 Author Share Posted July 18, 2010 Great guys It works thanks to both of you, I think I just had a dummy moment. Thanks again. 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