Engineer 0 Posted August 26, 2011 $pixle2 = PixelSearch(389, 144, 436, 180, 0xCA372D) If IsArray($pixle2) Then If PixelSearch(389, 144, 406, 162, 0xCA372D) Then MsgBox(1, "its Here", "its here") EndIf Else MsgBox(1, "nothing", "Nothing") EndIf this code works when there is nothing found. but when it does find something, it doesn't pop up the msg box"its here". I know theres probably a simple soulution, but I can't see it. some help would be apricated. Share this post Link to post Share on other sites
Spiff59 54 Posted August 26, 2011 (edited) You have no else condition for your second "If" statement. If the first If is true, and the second is false, the program goes on to the next statement without any message displayed. Edit: In other words, it's not finding something (your target color value at that specific coordinate), but $pixle2 is an array. Edited August 26, 2011 by Spiff59 Share this post Link to post Share on other sites
Engineer 0 Posted August 26, 2011 $pixle2 = PixelSearch(309, 145, 347, 179, 0xCA372D) If IsArray($pixle2) Then If PixelSearch(309, 145, 323, 161, 0xCA372D) Then MsgBox(1, "its Here", "its here") Else EndIf Else MsgBox(1, "nothing", "Nothing") EndIf I've added the end if. the point of the program is to locate the pixel in a generalized area, then localize the search to a smaller area. this time its not bringing up the Nothing MSGBOX, but it still won't display the its here MSGBOX. still confused.(as usuall) Share this post Link to post Share on other sites
hannes08 39 Posted August 26, 2011 $pixle2 = PixelSearch(309, 145, 347, 179, 0xCA372D) If IsArray($pixle2) Then If PixelSearch(309, 145, 323, 161, 0xCA372D) Then MsgBox(1, "its Here", "its here") Else ; <<<<<<<<<<<<<< Let's see what we missed here .... EndIf Else MsgBox(1, "nothing", "Nothing") EndIf Script logical fault in line marked with "<<<<<..." Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Share this post Link to post Share on other sites
Engineer 0 Posted August 27, 2011 Call me an idiot, but the way you had it doesn't work. Obviously something has to go in there, but I don't want it to do any thing. just 2 possible outcomes for 3 variables. any advice? Share this post Link to post Share on other sites
czardas 1,269 Posted August 27, 2011 (edited) $sMsg = "nothing" $pixle2 = PixelSearch(389, 144, 436, 180, 0xCA372D) If IsArray($pixle2) And IsArray(PixelSearch(389, 144, 406, 162, 0xCA372D)) Then $sMsg = "its Here" MsgBox(1, $sMsg, $sMsg) Is this what you want? Edited August 27, 2011 by czardas operator64 ArrayWorkshop Share this post Link to post Share on other sites
Engineer 0 Posted September 1, 2011 the and really helped. but just out of curosity, how am I susposed to make it do an action only when the second part is false and the first part is true. like $pixle2 =true + the AND is false=do action 1 $pixle2=true + the AND is true=do action 2 $pixle2=false+the AND is false=do nothing there can't be another out come since the second pixle search is a possible part of the picture its scaning. its rather confusing, all in all. Share this post Link to post Share on other sites
JohnOne 1,603 Posted September 1, 2011 $pixle2 = PixelSearch(389, 144, 436, 180, 0xCA372D) If IsArray($pixle2) Then $Temp = PixelSearch(389, 144, 406, 162, 0xCA372D) If IsArray($Temp) Then MsgBox(1, "its Here", "its here") EndIf Else MsgBox(1, "nothing", "Nothing") EndIf AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
czardas 1,269 Posted September 1, 2011 (edited) how am I susposed to make it do an action only when the second part is false and the first part is true. like $pixle2 =true + the AND is false=do action 1 $pixle2=true + the AND is true=do action 2 $pixle2=false+the AND is false=do nothing Work through it logically like this: $pixle2 = PixelSearch(389, 144, 436, 180, 0xCA372D) If IsArray($pixle2) Then $Temp = PixelSearch(389, 144, 406, 162, 0xCA372D) If IsArray($Temp) Then ; Both searches yielded results MsgBox(1, "Doing", "Action 2") ; Perform Action 2 Else ; The previous If statement was false MsgBox(1, "Doing", "Action 1") ; Perform Action 1 EndIf Else ; This else statement is not needed (see the next version) MsgBox(1, "Not needed", "Nothing in particular") ; Code for doing nothing EndIf So we can simplify the above code to get: $pixle2 = PixelSearch(389, 144, 436, 180, 0xCA372D) If IsArray($pixle2) Then $Temp = PixelSearch(389, 144, 406, 162, 0xCA372D) If IsArray($Temp) Then MsgBox(1, "Doing", "Action 2") ; Perform Action 2 Else MsgBox(1, "Doing", "Action 1") ; Perform Action 1 EndIf EndIf OR (if you are not interested in the pixel's coordinates) If IsArray(PixelSearch(389, 144, 436, 180, 0xCA372D)) Then If IsArray(PixelSearch(389, 144, 406, 162, 0xCA372D)) Then MsgBox(1, "Doing", "Action 2") ; Perform Action 2 Else MsgBox(1, "Doing", "Action 1") ; Perform Action 1 EndIf EndIf Edited September 1, 2011 by czardas operator64 ArrayWorkshop Share this post Link to post Share on other sites