trids Posted August 14, 2006 Share Posted August 14, 2006 I'm trying to determine where in a window's client area a certain image appears. It would be in one of three places, and I'm trying to use PixelCheckSum on these three areas to see which one contains the target. But it looks like the checksum is not always the same for a given image, based on my tests so far . I seem to get 2 distinct values for the same target based on a trial of about 20 tests: one value appears about 80% of the time, but the other appears too often to dismiss as chance.Question-1: Can I fairly expect PixelCheckSum to return the same value for a given image no matter where it is in a client area, or does its algorithm not allow for this?Question-2: Is there a better way than PixelCheckSum to find which one of three areas contains a target image? Or to rephrase the goal a little differently, is there a better way to find a target image within a given area?Question-3: It is a huge pain (and may even be the source of my problem) to determine the checksum of a target image at design time. Is there any chance of having a function (not a UDF, please, a built-in one intrinsic to AU3!) that can determine the checksum from a file? This would enable me to save a section of a screen dump to file (GIF / PNG / BMP / whatever), whose PiXelCheckSum I can then determine and use in checking the 3 regions.Larry? Anyone?TIA Link to comment Share on other sites More sharing options...
Valik Posted August 14, 2006 Share Posted August 14, 2006 Can you create a simple reproduction script that shows PixelCheckSum() returning different results for the same pixels? I'm pretty sure that's not supposed to happen. Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 14, 2006 Administrators Share Posted August 14, 2006 If it's for a game then there are all sorts of alpha blending things that can screw it up. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
trids Posted August 15, 2006 Author Share Posted August 15, 2006 I'm afraid it's not even as noble as a game :"> For purely academic purposes, I'm trying to find the "Use Evaluation Version" button on the popup that displays when you start Winzip. You can't rely on the button name or ID, cos they change from time to time, and even the button's position changes randomly.Happily though, I have now found an easier solution by approaching from a slightly different angle. The script below seems to work all the time, so the effect of different checksums for the same image (which gave rise to my first post) must have been due to slight discrepancies in my aim when I was trying to determine the checksum manually. The second script overcomes manual shakes by ALWAYS looking in the same places for the three buttons, and reports on the PixelCheckSum for them. To be used when determining the hardcoded value for the first script.Thanks for the kind attention, guys ;Waits for the popup to appear, then click the disabled button. ;If there is no disabled button, find the right one with PixelCheckSum Opt("PixelCoordMode",2) Opt("MouseCoordMode",2) $sTitle = "WinZip" WinWaitActive( $sTitle ) $nCtl = 0 If ControlCommand( $sTitle, "", 2901, "IsEnabled", "" ) = 0 Then $nCtl = 2901 If ControlCommand( $sTitle, "", 2902, "IsEnabled", "" ) = 0 Then $nCtl = 2902 if $nCtl <> 0 then ;target has been identified as the disabled button ControlEnable( $sTitle, "", $nCtl ) ControlClick ( $sTitle, "", $nCtl ) else ;hmmm, they're all active, so we have to resort to pixelchecksums if PixelChecksum( 12, 255, 12 + 134, 255 + 23) = 2582112889 Then ;Click the Left button MouseClick( "left", 14, 257, 1, 0 ) else ;Click the Middle one MouseClick( "left", 157, 257, 1, 0 ) endif Endif oÝ÷ ÙK¶¬r¸©µ·¥£huë^®h§zØ^r˦¶¬z)íê'y¦è½æ®¶scµ&W÷'G2öâFR6V6·7VÒf÷"V6'WGFöââvå¦7Æ6væF÷p £°VÄ6V6·7VÒÄTeEô%UEDôâÒ#S##²fÇC²ÒÒW6RWfÇVFöâfW'6ö⣰VÄ6V6·7VÒÔDDÄUô%UEDôâÒS3sC2²fÇC²ÒÒ'Wæ÷p£°VÄ6V6·7VÒ$tEô%UEDôâÒcC3Cc²fÇC²ÒÒVçFW"&Vv7G&Föâ6öFP£°ÒÒУ°VÄ6V6·7VÒÄTeEô%UEDôâÒS3sC2²fÇC²ÒÒ'Wæ÷p£°VÄ6V6·7VÒÔDDÄUô%UEDôâÒ#S##²fÇC²ÒÒW6RWfÇVFöâfW'6öࣰVÄ6V6·7VÒ$tEô%UEDôâÒcC3Cc²fÇC²ÒÒVçFW"&Vv7G&Föâ6öFP ¢÷BgV÷CµVÄ6ö÷&DÖöFRgV÷C²Ã"¢÷BgV÷C´Ö÷W6T6ö÷&DÖöFRgV÷C²Ã" £·6WBFR¶W&÷G0¢÷D¶W6WBgV÷C·gV÷C²ÂgV÷Cµô6GW&RgV÷C²¢£·7F'BFRF7Æ¢ôFV'VrgV÷C²6G2gV÷C²¶÷VâÆörvæF÷p ¢b33c¶×5FFÆRÒgV÷Cµvå¦gV÷C° £¶ær&÷Væ@¢vÆR¢6ÆVW¢vVæ@ ¤gVæ2ô6GW&R£·FRVæBöbFR&Vâç6÷rFR6ö÷&G2äBFR6V6·7VТvä7FfFRb33c¶×5FFÆR¢ôFV'VrgV÷CµVÄ6V6·7VÒÄTeEô%UEDôâÒgV÷C²fײVÄ6V6·7VÒ"Â#SRÂ"²3BÂ#SR²#2¢ôFV'VrgV÷CµVÄ6V6·7VÒÔDDÄUô%UEDôâÒgV÷C²fײVÄ6V6·7VÒSRÂ#SRÂSR²3BÂ#SR²#2¢ôFV'VrgV÷CµVÄ6V6·7VÒ$tEô%UEDôâÒgV÷C²fײVÄ6V6·7VÒ#rÂ#SRÂ#r²3BÂ#SR²#2¢ôFV'VrgV÷C²ÒÒÒgV÷C²¤VæDgVæ0The _Debug UDF is by courtesy of Cyberslug 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