Jump to content

Question for Pixelsearch


Recommended Posts

i'm a total, and yes, TOTAL noob on autoit.. in fact.. scripting... the only script i'm familiar with is Flash scripting =x

ok, but right now, i've roughly guessed how to make it work properly, the only thing right now is... i cannot differenciate the coordinates in pixelsearch.

i read through their helpfile, they told me "right top left bottom" respectively. but when i use "autoit window info", it only gave me x and y, ended up i dont know where to put what.... so someone please enlighten me >.<

thank you

Link to comment
Share on other sites

i'm a total, and yes, TOTAL noob on autoit.. in fact.. scripting... the only script i'm familiar with is Flash scripting =x

ok, but right now, i've roughly guessed how to make it work properly, the only thing right now is... i cannot differenciate the coordinates in pixelsearch.

i read through their helpfile, they told me "right top left bottom" respectively. but when i use "autoit window info", it only gave me x and y, ended up i dont know where to put what.... so someone please enlighten me >.<

thank you

Another testament to this cause!

http://www.autoitscript.com/forum/index.ph...c=31346&hl=

Link to comment
Share on other sites

omg... i'm so bad with maths... i failed it real hard... >.<

need some example... ~.~ such as like.. when "x = 88 y = 96" is shown on autoit window info,

so what will x1,y1 x2,y2 be?

Link to comment
Share on other sites

Not trying to be cruel, but this aint advance math.

PixelSearch is explained simple inn the helpfile.

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

Here you go image illustration with code matching it :)

post-16522-1178487809_thumb.jpg

$color = 0x000000

$top = 40
$left = 45

$height = 200 + $left
$width = 150 + $top

$search = PixelGetColor($left,$top,$width,$height,$color)
If Not @error Then
    MsgBox(0, "Yeeey search finished with good results.", 'Your color was found at location: X:' & $search [0] & " Y:" & $search [1])
EndIf

BTW: Searches within the illustrated window inn the example image.

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

erm... sorry, but i still dont get it...

first, i can safely conclude that pixelsearch is to find the corresponding colour i've indicated it to find in an area of rectangle right? let's say, if i want it to search a specific area for that colour, example white (#FFFFFFF), what should i key in?

for example, the autoit window info says x = 88 y = 96, what should the parameter be?

the monitor is 1024 768 wide.

pixelsearch( ?left, ?top, ?right, ?bottom, #FFFFFFF )

Link to comment
Share on other sites

x = 88, y = 96

This is only 1 point on your monitor. 1 Pixel. its not a region to search.

To define the rectangle, you take the (x,y) positions for 2 points you will end up with an (X1, X2, Y1, and Y2); One at the top left of the rectangle, and one at the bottom right of the rectangle.

Then, they are put in the function like this

PixelSearch( X1, Y1, X2, Y2, Color)

Link to comment
Share on other sites

mmhhmm, look at the image again, X1 Y1 describe the upper left corner of this "rectangle" that the function will search, now X2 Y2 describe the bottom right of this box...

if I wanted it to search the whole screen, I would set X1 to 0 and Y1 to 0, because thats the beginning of the screen, then X2 will be @desktopwidth because it represents the width of the whole screen, and same with Y2 = @desktopheight

PixelSearch(0,0,@DesktopWidth,@DesktopHeight,COLOR)

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

so x1, y1 (88, 96) coordinates will be the upper left corner of the rectangle which i'm trying to search?

then x2, y2 will the lower right corner of the rectangle?

so in short, it will be something like (88, 96, x2, y2)?

example again:

coordinates for the top left corner, (88, 96)

coordinates for the bottom right corner, (92, 100)

colours White (#FFFFFFF)

so the command will be

Pixelsearch(88, 96, 92, 100, #FFFFFFF)

???

Link to comment
Share on other sites

eh.. wait.. i realise something...

the above thread state that x2 y2 is the width and height of the entire square...

to reconfirm...

x = 88, y = 96

width = 100, height = 150

so the coding will be

pixelsearch( 88, 96, 100, 150, 0x#FFFFFFF)

and that will command it to search for #FFFFFFF within the box which it's top left corner starting from coordinates 88, 96?

Link to comment
Share on other sites

eh.. wait.. i realise something...

the above thread state that x2 y2 is the width and height of the entire square...

to reconfirm...

x = 88, y = 96

width = 100, height = 150

so the coding will be

pixelsearch( 88, 96, 100, 150, 0x#FFFFFFF)

and that will command it to search for #FFFFFFF within the box which it's top left corner starting from coordinates 88, 96?

Not quite.

Here, let me explain it in steps.

  • Find your rectangular region on your screen (no need for numbers yet, just visualize it)
  • Open the Autoit Window Info tool
  • Move your mouse to the top-left-hand corner of the region.
  • Record the (x,y) values from the Window info tool (For reference, this is X1 and Y1)
  • Move mouse to the bottom-right-hand corner of the region
  • Record the (x,y) values from the Window info tool (For reference, this is X2 and Y2)
Now for your code, Format the call like:

PixelSearch( X1, Y1, X2, Y2, Color)

Does that clarify it at all?

Link to comment
Share on other sites

so x1, y1 (88, 96) coordinates will be the upper left corner of the rectangle which i'm trying to search?

then x2, y2 will the lower right corner of the rectangle?

so in short, it will be something like (88, 96, x2, y2)?

example again:

coordinates for the top left corner, (88, 96)

coordinates for the bottom right corner, (92, 100)

colours White (#FFFFFFF)

so the command will be

Pixelsearch(88, 96, 92, 100, #FFFFFFF)

???

erm... so this is correct instead?

Link to comment
Share on other sites

coordinates for the top left corner, (88, 96)

coordinates for the bottom right corner, (92, 100)

colours White (#FFFFFFF)

so the command will be

Pixelsearch(88, 96, 92, 100, #FFFFFFF)

Everything you say in this post is correct, apart from the last parameter. I did show you how it was supposed to be,

but obviously the only thing you considered slightly and used from that was the 0x-prefix (0x#FFFFFFF ?), ignoring

everything else completely.

So, did you try the code in my post ?

Edit : wording

Edited by Helge
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...