Jump to content
Sign in to follow this  
Symplystyc

pixel searching problem

Recommended Posts

I'm trying to find the positions of several pixels on a webpage, unfortunatly these pixels move everytime the page is loaded so I thought I'd do a pixel search and have my search area change based on where/if the correct colored pixel was located, this information would then be written in an array so that I could pick my x and y coordinates later.

$m = 20  ;~~X coordinate for top left corner of search area

$n = 256 ;~~Y coordinate for top left corner of search area

$i = 0    ;~~ Counter

while $i < 5;~~ just need this to run 5 times

$Pos = PixelSearch($m,$n,50,706,0x9C9AFF,0,1);~~ Does a pixel search hopefully $n changes

FileOpen("pos.txt",1);~~ opens pos.txt

FileWrite("pos.txt",$pos[0] & @CRLF);~~ writes X coord in pos.txt

FileWrite("pos.txt",$pos[1] & @CRLF);~~ writes Y coord in pos.txt

_FileReadToArray("pos.txt",$array);~~ creates the array $array

$n = $array[$i + 2] + 15;~~ Found first pixel with color 0x9C9AFF now lets change $n so that next search starts below previous $m,$n possition.
$i = $i + 1;~~ Counter loop
  WEnd

picture of the searched area

Posted Image

resulting pos.txt file

38
292
38
394
24
151
38
496
24
151

first two coordinates are correct but the third is wrong.

array looks like this

Row  Column
[0]    11
[1]    38
[2]    292
[3]    38
[4]    394
[5]    24
[6]    151
[7]    38
[8]    496
[9]    24
[10]     151
[11]

rows 5,6,9, and 10 dont make sense to me seeing as I'm adding to the Y coordinate only.


The glass is neither half empty nor half full, it is simply twice as big as it needs to be.

Share this post


Link to post
Share on other sites

$Pos = PixelSearch($m,$n,50,706,0x9C9AFF,0,1);~~ Does a pixel search hopefully $n changes

r all spots with the same collor on this img i see every spot with diffrent collor?


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

r all spots with the same collor on this img i see every spot with diffrent collor?

that maybe because of saving that image with photoshop. Using the au3info script on the webpage I get that there all the same color.


The glass is neither half empty nor half full, it is simply twice as big as it needs to be.

Share this post


Link to post
Share on other sites

that maybe because of saving that image with photoshop. Using the au3info script on the webpage I get that there all the same color.

I guess I could try doing a pixel search for a pixel that was not the same as the background color.


The glass is neither half empty nor half full, it is simply twice as big as it needs to be.

Share this post


Link to post
Share on other sites

What's the point of reading it from the file, which is awkward and seems to be failing. You already have the coordinate of the last find in $pos. Why not just use:

$n = $pos[1] + 15

:)

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

Share this post


Link to post
Share on other sites

I guess I could try doing a pixel search for a pixel that was not the same as the background color.

heare is something 4 you to work on

Sleep(5000)
$i = 0      ;~~ Counter
$objectH = "6" ;<== put heare the :y size of object
$color = "0x002B9C"
$Pos = PixelSearch(20,230,50,706,$color,0);~~ Does a pixel search hopefully $n changes
MouseMove($pos[0],$pos[1],1)
Sleep(5000)
Do
    $Pos = PixelSearch(20,$Pos[1]+$objectH,50,706,$color,0);~~ Does a pixel search hopefully $n changes
    $i = $i + 1;~~ Counter loop
    MouseMove($pos[0],$pos[1],1)
    Sleep(5000)
Until $i = 4

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

What's the point of reading it from the file, which is awkward and seems to be failing. You already have the coordinate of the last find in $pos. Why not just use:

$n = $pos[1] + 15

:)

Yeah I dont know the point but what you did works perfectly thanks.


The glass is neither half empty nor half full, it is simply twice as big as it needs to be.

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...