Regency Posted March 13, 2008 Share Posted March 13, 2008 (edited) I am trying to compare 9 different pictures each with a specific pixel i am getting from GetPixelColor(), They all have the same pixel color except for one, It can be any of the 9 pictures, so its 8 of the same color and 1 thats out of order. Anyone have a better way to figure out the colors and compare them and click the odd one out? expandcollapse popupGlobal $1Color = PixelGetColor(399, 280) Global $2Color = PixelGetColor(499, 280) Global $3Color = PixelGetColor(599, 280) ;First Global $4Color = PixelGetColor(399, 380) Global $5Color = PixelGetColor(499, 380) Global $6Color = PixelGetColor(599, 380) ;Second Line Global $7Color = PixelGetColor(399, 480) Global $8Color = PixelGetColor(499, 480) Global $9Color = PixelGetColor(599, 480)oÝ÷ Ù«¢+ÙÕ¹MÉ¥ÁÑ ¡¬ ¤)%ÀÌØìÅ ½±½ÈôÀÌØìÉ ½±½ÈôÀÌØìÍ ½±½ÈQ¡¸(% ¡1¥¹Qݼ ¤(%±Í¥ÀÌØìÅ ½±½È±ÐìÐìÀÌØìÉ ½±½ÈôÀÌØìÍ ½±½ÈQ¡¸($í%¹ÍÉÐ¥ÉÍÐ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸÄÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤(%±Í%ÀÌØìÅ ½±½ÈôÀÌØìÉ ½±½È±ÐìÐìÀÌØìÍ ½±½ÈQ¡¸($$í%¹ÍÉÐQ¡¥É ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸÌÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤(%±Í%ÀÌØìÅ ½±½È±ÐìÐìÀÌØìÉ ½±½È±ÐìÐìÀÌØìÍ ½±½ÈQ¡¸($$í%¹ÍÉÐM½¹ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸÈÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤(%¹%)¹Õ¹(()Õ¹ ¡1¥¹Qݼ ¤(%%ÀÌØìÑ ½±½ÈôÀÌØìÕ ½±½ÈôÀÌØìÙ ½±½ÈQ¡¸($% ¡1¥¹Q¡É ¤($%±Í¥ÀÌØìÑ ½±½È±ÐìÐìÀÌØìÕ ½±½ÈôÀÌØìÙ ½±½ÈQ¡¸($$í%¹ÍÉнÕÉÑ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸÐÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤($%±Í¥ÀÌØìÑ ½±½ÈôÀÌØìÕ ½±½È±ÐìÐìÀÌØìÙ ½±½ÈQ¡¸($$í%¹ÍÉÐM¥áÑ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸØÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤($%±Í¥ÀÌØìÑ ½±½È±ÐìÐìÀÌØìÕ ½±½È±ÐìÐìÀÌØìÙ ½±½ÈQ¡¸($$$í%¹ÍÉÐ¥Ñ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸÔÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤(%¹%)¹Õ¹()Õ¹ ¡1¥¹Q¡É ¤(%%ÀÌØìÝ ½±½ÈôÀÌØìá ½±½ÈôÀÌØìå ½±½ÈQ¡¸($íIÍÑÉÐMÉ¥ÁÐ($%}%Ñ¥½¸ ÀÌØí É¥µÌ°ÅÕ½Ðí ¬ÅÕ½Ðì¤($$ÀÌØí½I¥¼ô}%Ñ=© å% ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÁ}5¥¹A ½¹Ñ¹Ñ}ɱ É¥µÍ|àÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½I¥¼°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíѹ ½µµ¥ÐÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%MÉ¥ÁÑ ¡¬ ¤(%±Í%ÀÌØìÝ ½±½È±ÐìÐìÀÌØìá ½±½ÈôÀÌØìå ½±½ÈQ¡¸($$$í%¹ÍÉÐMÙ¹Ñ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸÜÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤($%±Í¥ÀÌØìÝ ½±½ÈôÀÌØìá ½±½È±ÐìÐìÀÌØìå ½±½ÈQ¡¸($$í%¹ÍÉÐ9¥¹Ñ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸäÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤($%±Í¥ÀÌØìÝ ½±½È±ÐìÐìÀÌØìá ½±½È±ÐìÐìÀÌØìå ½±½ÈQ¡¸($$$í%¹ÍÉÐ¥¡Ñ ½à ±¥¬($$ÀÌØí½MÕµ¥Ðô}%Ñ=© å9µ ÀÌØí É¥µÌ°ÅÕ½ÐíÑ°ÀÀÀÌØí5¥¹A ½¹Ñ¹ÐÀÌØíÙ± É¥µÌÀÌØíѸàÅÕ½Ðì¤($%}%Ñ¥½¸ ÀÌØí½MÕµ¥Ð°ÅÕ½Ðí±¥¬ÅÕ½Ðì¤($%}%1½]¥Ð ÀÌØí É¥µÌ¤($%}%EեРÀÌØí É¥µÌ¤(%¹%)¹Õ¹ Edited March 13, 2008 by Regency Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted March 13, 2008 Share Posted March 13, 2008 you're comparing, right? why bury yourself in scary code when you can do something like this: first, build this dim $pixel1=whatever $pixel1=pixelgetcolor(x, y) msgbox (1, "pixel", $pixel1) write whatever you got from the message box on a piece of paper or something now, build this $dim const pixel1=whatever $dim pixel11=0 $pixel11=pixelgetcolor(x, y) if $pixel11=$pixel1 then <insert clicking code here> endif else <do something else here> endif except do that nine times. i'm pretty sure that's the "retard version", but i'm confident it'll work. Link to comment Share on other sites More sharing options...
Regency Posted March 14, 2008 Author Share Posted March 14, 2008 I dont think that would work for what i am trying to do... Link to comment Share on other sites More sharing options...
Regency Posted March 14, 2008 Author Share Posted March 14, 2008 Bump? Link to comment Share on other sites More sharing options...
Regency Posted March 14, 2008 Author Share Posted March 14, 2008 Bump UGH help!! Link to comment Share on other sites More sharing options...
bogQ Posted March 15, 2008 Share Posted March 15, 2008 (edited) Bump UGH help!! I dont think that you gaved enought info. about all this, this is how i think that all this shud looklike (dono if this is working at all, becose you did not posted anything to test it on, so i didnt try to test anything) something like this... expandcollapse popupGlobal $1Color = PixelGetColor(399, 280) Global $2Color = PixelGetColor(499, 280) Global $3Color = PixelGetColor(599, 280) Global $4Color = PixelGetColor(399, 380) Global $5Color = PixelGetColor(499, 380) Global $6Color = PixelGetColor(599, 380) Global $7Color = PixelGetColor(399, 480) Global $8Color = PixelGetColor(499, 480) Global $9Color = PixelGetColor(599, 480) Select case $1Color = $2Color $goodcolor = $1Color Case $1Color <> $2Color $goodcolor = $3Color EndSelect If $1Color = $2Color = $3Color = $4Color = $5Color = $6Color = $7Color = $8Color = $9Color Then _IEAction($Crimes, "Back") $oRadio = _IEGetObjById($Crimes, "ctl00_MainPageContent_rblCrimes_8") _IEAction($oRadio, "click") Else Select case $1Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn1") case $2Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn2") case $3Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn3") case $4Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn4") case $5Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn5") case $6Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn6") case $7Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn7") case $8Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn8") case $9Color <> $goodcolor $oSubmit=_IEGetObjByName($Crimes, "ctl00$MainPageContent$valCrimes$btn9") EndSelect _IEAction($oSubmit, "click") _IELoadWait($Crimes) _IEQuit($Crimes) EndIf Edited March 15, 2008 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 15, 2008 Moderators Share Posted March 15, 2008 (edited) I didn't put much thought into this... but this might work:;Should return an array [0] = X [1] = Y ;Should return unique pixel color found $aArrayCoords = _myOddOutPixelChecking() MsgBox(64, "Info", "XCoord = " & $aArrayCoords[0] & " | YCoord = " & $aArrayCoords[1]) Func _myOddOutPixelChecking() Local $aXCoords[10] = ["", 399,499,599,399,499,599,399,499,599] Local $aYCoords[10] = ["", 280,280,280,380,380,380,480,480,480] Local $aColor[10] = ["", PixelGetColor(399, 280), _ PixelGetColor(499, 280), PixelGetColor(599, 280), _ PixelGetColor(399, 380), PixelGetColor(499, 380), _ PixelGetColor(599, 380), PixelGetColor(399, 480), _ PixelGetColor(499, 480), PixelGetColor(599, 480)] Local $aReturn[2], $iCC, $sHoldVal = $aColor[1] & "," For $iCC = 2 To 9 If StringInStr("," & $sHoldVal, "," & $aColor[$iCC] & ",") Then $sHoldVal &= $aColor[$iCC] & "," Else $aReturn[0] = $aXCoords[$iCC] $aReturn[1] = $aYCoords[$iCC] EndIf Next $sHoldVal = StringSplit(StringTrimRight($sHoldVal, 1), ",") If $sHoldVal[0] > 1 Then Return $aReturn $aReturn[0] = 399 $aReturn[1] = 280 Return $aReturn EndFunc Edited March 15, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Regency Posted March 16, 2008 Author Share Posted March 16, 2008 ~BogQ Yours has some good idea, but doesnt work in how i want this to work.. I need to to check the pixel color and compare it between the other 2, each line has its own color code. If red as 12222 on line one it could have 44422 on line two, so it wont always see the same thing in each get color And Smoke, Yours just confuses me.. i dont think it does anything Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 16, 2008 Moderators Share Posted March 16, 2008 ~BogQYours has some good idea, but doesnt work in how i want this to work..I need to to check the pixel color and compare it between the other 2, each line has its own color code. If red as 12222 on line one it could have 44422 on line two, so it wont always see the same thing in each get colorAnd Smoke,Yours just confuses me.. i dont think it does anythingIt does what I understood you wanted.9 Pixel checksReturn the 1 that is odd out of the 9And yes, it "does do that".Now I took my time to do that for you... your turn . Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 16, 2008 Moderators Share Posted March 16, 2008 (edited) ~BogQ Yours has some good idea, but doesnt work in how i want this to work.. I need to to check the pixel color and compare it between the other 2, each line has its own color code. If red as 12222 on line one it could have 44422 on line two, so it wont always see the same thing in each get color And Smoke, Yours just confuses me.. i dont think it does anythingI modded it to work on all 3 X level separately like you have suggested here. I have tested it, and it does work. It returns a 2 dimensional array. The first dimension are the 3 loops of x coords it goes through [0][0] = [loop 1][Xcoord Found] [0][1] = [loop 1][Ycoord Found] [0][2] = [loop 1][Color Found] [1][0] = [loop 2][Xcoord Found] [1][1] = [loop 2][Ycoord Found] [1][2] = [loop 2][Color Found] [2][0] = [loop 3][Xcoord Found] [2][1] = [loop 3][Ycoord Found] [2][2] = [loop 3][Color Found] I didn't do an extensive test, I just quickly modded my other one... so you may have to bug proof it... and there may be an easier way... but the way you talked, I didn't feel like wasting any more brain power on simplifying it for you. Edit: Forgot to add the code #include <array.au3> $aArrayCoords = _myOddOutPixelChecking() _ArrayDisplay($aArrayCoords) Func _myOddOutPixelChecking() Local $aXCoords[3] = [399,499,599] Local $aYCoords[3] = [280,380,480] Local $aRow[3][3] = [[PixelGetColor(399, 280), PixelGetColor(499, 280), PixelGetColor(599, 280)], _ [PixelGetColor(399, 380), PixelGetColor(499, 380), PixelGetColor(599, 380)], _ [PixelGetColor(399, 480), PixelGetColor(499, 480), PixelGetColor(599, 480)]] Local $aReturn[3][3], $iCC For $iCC = 0 To 2 If ($aRow[$iCC][0] == $aRow[$iCC][1]) And ($aRow[$iCC][0] <> $aRow[$iCC][2]) Then $aReturn[$iCC][0] = $aXCoords[2] $aReturn[$iCC][1] = $aYCoords[2] $aReturn[$iCC][2] = $aRow[$iCC][2] ElseIf ($aRow[$iCC][1] == $aRow[$iCC][2]) And ($aRow[$iCC][1] <> $aRow[$iCC][0]) Then $aReturn[$iCC][0] = $aXCoords[0] $aReturn[$iCC][1] = $aYCoords[0] $aReturn[$iCC][2] = $aRow[$iCC][0] ElseIf ($aRow[$iCC][2] == $aRow[$iCC][0]) And ($aRow[$iCC][2] <> $aRow[$iCC][1]) Then $aReturn[$iCC][0] = $aXCoords[1] $aReturn[$iCC][1] = $aYCoords[1] $aReturn[$iCC][2] = $aRow[$iCC][1] EndIf Next Return $aReturn EndFunc Edit2: Changed the function... If all the elements are blank, then it didn't find a unique color in any of the X rows. Edited March 16, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Regency Posted March 16, 2008 Author Share Posted March 16, 2008 Smoke the only reason i said it didnt do anything is because i have really no clue about arrays and was trying to figure out how to use it for my script and had no clue how to impliment it. Like i just spend 30 min trying to figure out exactly what happens on each line of your new code. I am sorry if i was being snippy, I just didnt understand it. Your code prob works, but i would need some explination on how i would put the extra code i need into it, and exactly what your script does because i dont really understand arrays... Link to comment Share on other sites More sharing options...
Regency Posted March 17, 2008 Author Share Posted March 17, 2008 Bump Link to comment Share on other sites More sharing options...
Regency Posted March 21, 2008 Author Share Posted March 21, 2008 Bump 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