FrozenScriptz Posted May 20, 2010 Posted May 20, 2010 How do i use pixel search???, the autoit help file is not explaining it well, this is the code autoit help was saying PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] ) and now I'm really confused what that is, left top right bottom? i don't understand, but i understand the colour,its like 0xFF0000(which is pure red) so can someone please help me?
FrozenScriptz Posted May 20, 2010 Author Posted May 20, 2010 How do i use pixel search???, the autoit help file is not explaining it well, this is the code autoit help was saying PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] ) and now I'm really confused what that is, left top right bottom? i don't understand, but i understand the colour,its like 0xFF0000(which is pure red) so can someone please help me? I know that left is a coordinate of a rectangle and same for the others, but i just don't get it.
JohnOne Posted May 20, 2010 Posted May 20, 2010 say you want to search an area of your screen from the top left corner, 50 pixels across and 50 pixels down for red. $aResult = PixelSearch(0,0,50,50,0xFF0000) Returns an array of coroordinates to the pixel if it finds one. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted May 21, 2010 Posted May 21, 2010 With what? $aResult[0] contains the x coord $aResult[1] contains the y coord AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
FrozenScriptz Posted May 22, 2010 Author Posted May 22, 2010 Okay so is this like this?$frozen = PixelSearch(0, 326, 0, 317, 0xFF0000)I am so confused right nowyou said that 0, 0 is the X coordinates and 50, 50 is the Y Coordinates.I just dont get it.Please explain it better so i can understand, I am really confused right now.
Moderators SmOke_N Posted May 22, 2010 Moderators Posted May 22, 2010 Left = the x top left of the rectangle to search starting positionTop = the y top left of the rectangle to search starting positionRight = the x bottom right of the rectangle to search starting positionBottom = the y bottom right of the rectangle to search starting positionExample image:http://www.autoitscript.com/forum/index.php?app=core&module=attach§ion=attach&attach_rel_module=post&attach_id=11670 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.
Malkey Posted May 22, 2010 Posted May 22, 2010 If you run this example, it should help you understand the screen coordinate system and the window or client coordinate system being used. Move the cursor, and try to understand why the "x" and "y" values, (coordinates), change the way they do change. Press Esc to exit. #include <WinAPI.au3> Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client HotKeySet("{ESC}", "Terminate") Local $exit = 1 While $exit Sleep(10) TtColXY() WEnd ; TtColXY() Tooltip shows colour, and cursor position relative to screen and window. Func TtColXY() $aPos = MouseGetPos() Local $tPosS = _WinAPI_GetMousePos() ; similar to MouseGetPos() ;Screen mouse position $hHwnd = _WinAPI_WindowFromPoint($tPosS) Local $tPosC = _WinAPI_GetMousePos(True, $hHwnd) $sColor = "0x" & Hex(PixelGetColor(DllStructGetData($tPosS, "X"), DllStructGetData($tPosS, "Y")), 6) $iPosX = ($aPos[0] - 100) * ($aPos[0] > @DesktopWidth * 0.90) + ($aPos[0] <= @DesktopWidth * 0.90) * ($aPos[0] + 3) $iPosY = ($aPos[1] - 30) * ($aPos[1] > @DesktopHeight * 0.96) + ($aPos[1] <= @DesktopHeight * 0.96) * ($aPos[1] + 3) ToolTip("Color is: " & $sColor & @CRLF & "Screen: X: " & DllStructGetData($tPosS, "X") & " Y: " & DllStructGetData($tPosS, "Y") & @CRLF _ & "Client: X: " & DllStructGetData($tPosC, "X") & " Y: " & DllStructGetData($tPosC, "Y"), $iPosX, $iPosY) Return EndFunc ;==>TtColXY Func Terminate() $exit = 0 EndFunc ;==>Terminate
FrozenScriptz Posted May 23, 2010 Author Posted May 23, 2010 (edited) So Those coordinates are the coordinates of a rectangle. But please tell me how to find the coordinates of a file i want to find can you please make the code,I really want to make game bots. Edited May 23, 2010 by FrozenScriptz
Recommended Posts