NewToIt Posted March 9, 2013 Share Posted March 9, 2013 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 Link to comment Share on other sites More sharing options...
JohnOne Posted March 9, 2013 Share Posted March 9, 2013 It depends on what you expect, and what you get. Also you should not redeclare a variable (Local $draai=$draai+1) is one example, within a loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
NewToIt Posted March 9, 2013 Author Share Posted March 9, 2013 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 Link to comment Share on other sites More sharing options...
JohnOne Posted March 9, 2013 Share Posted March 9, 2013 works perfectly fine for me. It finds a white pixel and shows the x and y correctly. I have a tip though, your replies here may be as descriptive and complete as your questions. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
NewToIt Posted March 9, 2013 Author Share Posted March 9, 2013 HiIt's amazing that today (after rebooting, I guess) this code is again working as intended I think that PixelGetColor is more robust than PixelSearch. At first my code worked well for me too, butit 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 ina 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 Ifound; am I right?andIs there an english spell-checker in this forum message editor? (my native language is not english)Thank you Link to comment Share on other sites More sharing options...
Developers Jos Posted March 9, 2013 Developers Share Posted March 9, 2013 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 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
NewToIt Posted March 9, 2013 Author Share Posted March 9, 2013 Nederlands ? I am using the spelling options available in the browsers these days.JosYes!("There goes nothing above Groningen !")I think I'll try that also, in Firefox ........ .... It worksBtw, did you look at my code, and can (with a "c" instead of "k", thanks Firefox ) you reproduce the problem?Bye! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 9, 2013 Developers Share Posted March 9, 2013 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 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
NewToIt Posted March 9, 2013 Author Share Posted March 9, 2013 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 isshown at the screenSometimes it also automatically adds a (pure) black strip to fill the image, what is not acceptable, and I'm tryingto 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 Link to comment Share on other sites More sharing options...
NewToIt Posted April 10, 2013 Author Share Posted April 10, 2013 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 ) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now