Jump to content

Small help please (With pixel search)


Recommended Posts

Hello, fairly new to auto-it, but this is my first time needing to find a pixel.

Here is a simular example from the auto-it help file.

; Find a blue TP.

$coord = PixelSearch( 0,0,0,0, 0x7b7573, 50 )

If Not @error Then

MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

EndIf

There is two things I need to know...

A. What do I put for the cords here"( 0,0,0,0, 0x7b7573, 50 )"

I tryed to put x-y cords for each (All 4 spaces) but I got a error.

B. MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

Instead of a message box, how do I get it to mouse click the cords it finds (If it finds it)

Please and thankyou.

Link to comment
Share on other sites

A. What do I put for the cords here"( 0,0,0,0, 0x7b7573, 50 )"

Well how big of area are you pixel searching?

Instead of a message box, how do I get it to mouse click the cords it finds (If it finds it)

MouseClick would be the way to go. Look in the help file for PixelSearch, then look at the return value. It says

Returns a two-element array of pixel's coordinates. (Array[0]= x, Array[1] = y)

Which means the way to click it is by doing something like this.
MouseClick("Left", $Array[0], $Array[1], 1)

If you need more help let me know.

Link to comment
Share on other sites

Hello, fairly new to auto-it, but this is my first time needing to find a pixel.

Here is a simular example from the auto-it help file.

; Find a blue TP.

$coord = PixelSearch( 0,0,0,0, 0x7b7573, 50 )

If Not @error Then

MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

EndIf

There is two things I need to know...

A. What do I put for the cords here"( 0,0,0,0, 0x7b7573, 50 )"

I tryed to put x-y cords for each (All 4 spaces) but I got a error.

B. MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

Instead of a message box, how do I get it to mouse click the cords it finds (If it finds it)

Please and thankyou.

From the help file for PixelSearch(): The coordinates define x/y of the top/left corner, and x/y or the bottom/right corner, of a rectangle to search. The top/left corner of the desktop is 0,0. The bottom/right corner of your desktop depends on your screen resolution, but could be 1024,768 for example. To search to whole screen in this case would be:

$coord = PixelSearch(0, 0, 1024, 768, 0x7b7573, 50)
If Not @error Then
    MsgBox(0, "Results", "X = " & $coord[0] & "  Y = "  & $coord[1])
EndIf

Clear as mud...? :wacko:

Arghh... the Buckyball beat me to it! :D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Use the AutoIt Window Info Tool. Should be located somewhere around here C:\Program Files\AutoIt3\AU3Info.exe

Have that open then put your mouse over the color and you should see in the info box

">>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xE0DFE3 Dec: 14737379" something like that.

Straight from the help file

MouseClick ( "button" [, x, y [, clicks [, speed ]]] )

[optional] the speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...