Jump to content
Sign in to follow this  
NewToIt

Problem with PixelSearch

Recommended Posts

NewToIt

Hi, I'm a beginner to AutoIt with a question

I Have tried this:

--------------------------------------

$under = 750

do

LOCAL $poord = PixelSearch(800, $under, 20, $under-1, 0xFFFFFF)

Local $draai=$draai+1

if not @error then

$x= $poord[0]

$y= $poord[1]

MsgBox(0, "Place -", "Found x and y is: "& $x & " ," & $y)

Local $var = PixelGetColor($x, $y)

MsgBox(0, "The hex color is", Hex($var, 6))

MsgBox(0, "Line where found -", $under)

MsgBox(0, "Looped times -", $draai)

ExitLoop

Endif

$under=$under-2

until $under=600

--------------------------------------

But the result from PixelSearch is quite wrong, (or at least not what I expected) (confirmed by several tools, including AutoIt Window Info)

Can someone tell me what is wrong with this code?

Thank you

Share this post


Link to post
Share on other sites
NewToIt

I expected to get the x and y coordinates of a pixel with the colour Hex 0xFFFFFF. (that is pure white)

Instead I got the x and y coordinates of a pixel with a very different colour.

Thanks for your answer

Share this post


Link to post
Share on other sites
NewToIt

Hi

It's amazing that today (after rebooting, I guess) this code is again working as intended :o

I think that PixelGetColor is more robust than PixelSearch. At first my code worked well for me too, but

it mysteriously stopped working after I tried a lot of checking and speed optimizing.

PixelGetColor kept behaving as expected though.

It's a pity because I suppose PixelSearch is much faster than doing about the same thing with PixelGetColor in

a double loop eventually.

Are there more people with this problem?

2 more questions, a bit off-topic:

Beep, that I use sometimes to debug my code, will not work without arguments, contrary to the documentation I

found; am I right?

and

Is there an english spell-checker in this forum message editor? (my native language is not english)

Thank you

Share this post


Link to post
Share on other sites
Jos

Is there an english spell-checker in this forum message editor? (my native language is not english)

Nederlands ? :)

I am using the spelling options available in the browsers these days.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
NewToIt

Nederlands ? :)

I am using the spelling options available in the browsers these days.

Jos

Yes!

("There goes nothing above Groningen !")

I think I'll try that also, in Firefox ........ .... It works

Btw, did you look at my code, and can (with a "c" instead of "k", thanks Firefox :shifty: ) you reproduce the problem?

Bye!

Share this post


Link to post
Share on other sites
Jos

I have never ever used PixelSearch() in any of my scripts I created so don't know why you would ever need it for a corporate world script application.

Groningen ... is waar dat het "het einde van Nederland" is ... :)

Groet

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
NewToIt

I have never ever used PixelSearch() in any of my scripts I created so don't know why you would ever need it for a corporate world script application.

I am working with a big document-scanner, that automatically crops and straightens the scan. The result is

shown at the screen

Sometimes it also automatically adds a (pure) black strip to fill the image, what is not acceptable, and I'm trying

to build a background script to warn the user (by pop-up, sound, cd-tray open, whatever...) if that happens.

(! you can hardly see this black strip because the scan-table is quite dark-grey! )

That must happen in near real-time, reason why speed is important.

Bye

Share this post


Link to post
Share on other sites
NewToIt

I think i found the problem with Pixelsearch.

I was searching using:

$poord = PixelSearch(800, $under, 20, $under-1, 0xFFFFFF)

In a X64 Pc it only worked correctly when I changed the direction of the search.

At home I use a X32 Pc

$poord = PixelSearch(20, $under, 800, $under-1, 0xFFFFFF)

worked (always) correctly in both machines.

(I suppose the different graphic cards are not the problem.) :-(

But now I have another problem:

I have a loop that looks like this in pseudo code:

Do

Check_I_have_the_good_window

If_Good_window Then

PixelSearch

If not error then

Do_something

EndIf

EndIf

Loop until 1=0

I am checking if the user didn't start some other program (like Internet surfing etc.)

This check is made with the ActiveWindow function, and a few other checks.

But in Windows 7 you have the possibility to take a look at other windows (little size, or fullscreen size) hovering the mouse above

the pictograms of other programs in the dock under your screen. In this case what you see is not part of the active window.

Does someone know of a way to detect that (and when, and with what size) Win 7 is presenting these other windows?

Greetings

(Beste groeten, Jos :shifty: )

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  

×