christian11 0 Posted September 20, 2015 (edited) hello im newbie to this macro program. it is perfectly working fine, i wanted to loop clicking green button pixels until its gone to screen, however everytime there's 2 or more or another green pixel appeared. it clicks it even it is not successfully clicking the first pixel it sees until it disappear and and going nuts clicking any new green pixel it sees and appear.. could anyone suggest any idea how to achieve it? Func MainLoop() While 1 $green = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00ff00) If isArray($green) then MouseClick("primary", $green[0], $green[1] , 1, 0) RefinedLoop(pX, pY) } RefinedLoop(pX, pY) { while 1 pX = X + 50 pY = y + 50 dX = X - 50 dY = Y - 50 $green = PixelSearch($pX, $pY, $dX, $dY 0x00ff00) If isArray($green) then MouseClick("primary", $green[0], $green[1] , 1, 0) Else if @ErrorLevel <> 0 i++ If (i > 10) MainLoop() Edited September 20, 2015 by christian11 Share this post Link to post Share on other sites
christian11 0 Posted September 20, 2015 hi can you help me how to count pixelsearch? im new to this so please be gently :))example if there is 3 or more green pixel appear in screen it will do some statements$green = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00ff00 ) If $green >= 3 then Send("{5}") ;--- refresh the browser Sleep(700) Else do stuffs Share this post Link to post Share on other sites
kaisies 20 Posted September 20, 2015 you keep posting all these new threads, and half of them you just let die without answering peoples questions. What are you trying to automate? Share this post Link to post Share on other sites
computergroove 33 Posted September 20, 2015 Better English would help a lot. More source code would also help a lot.While 1 $Pixel1 = PixelGetColor(x1,y1) $Pixel2 = PixelGetColot(x2,y2) $Pixel3 = PixelGetColot(x3,y3) If $Pixel1 == Green Then MouseClick("",xcoord1,ycoord1) EndIf If $Pixel2 == Purple And $Pixel1 <> Green Then MouseClick("",xcoord2,ycoord2) EndIf If $Pixel3 == Blue And $Pixel1 <> Green Then MouseClick("",xcoord3,ycoord3) EndIf Sleep(1000) WEnd Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Share this post Link to post Share on other sites
water 2,359 Posted September 20, 2015 Better coding would help You have typos in your code plus you are doing string comparison (==) where a numeric comparison is needed. Green, Blue etc. should be variables or numeric values, right?Just my 2 cents My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
computergroove 33 Posted September 20, 2015 Actually I use this one a lot. Other than the color green being used instead of a dec or hex number, a == b translates to "if a is equal to b" Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Share this post Link to post Share on other sites
christian11 0 Posted September 20, 2015 you keep posting all these new threads, and half of them you just let die without answering peoples questions. What are you trying to automate?because it seems no ones replying my previous thread yet so i decided make different one..im trying to click buttons from a webpage Share this post Link to post Share on other sites
water 2,359 Posted September 20, 2015 But according to the help file '==' is a strict string comparison. You are comparing numbers. So AutoIt needs to do some extra processing. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
Jos 2,164 Posted September 20, 2015 (edited) because it seems no ones replying my previous thread yet so i decided make different one..That is the wrong answer. Stick to a single thread and reply in there.Topics merged.Jos Edited September 20, 2015 by 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. Share this post Link to post Share on other sites
christian11 0 Posted September 20, 2015 That is the wrong answer. Stick to a single thread and reply in there.Topics merged.Josuhhgg no sir you misunderstood. the thread has far different question and different situation.. the one is counting pixel and priority pixel btw from priorty pixeli've got an idea. can you suggest me if its okay? Func MainLoop() While 1 $green = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00ff00) If isArray($green) then MouseClick("primary", $green[0], $green[1] , 1, 0) RefinedLoop(pX, pY) } RefinedLoop(pX, pY) { while 1 pX = X + 50 pY = y + 50 dX = X - 50 dY = Y - 50 $green = PixelSearch($pX, $pY, $dX, $dY 0x00ff00) If isArray($green) then MouseClick("primary", $green[0], $green[1] , 1, 0) Else if @ErrorLevel <> 0 i++ If (i > 10) MainLoop() Share this post Link to post Share on other sites
Jos 2,164 Posted September 20, 2015 (edited) uhhgg no sir you misunderstood. the thread has far different question and different situation.. the one is counting pixel and priority pixel There wasn't much to misunderstand in your previous post as that clearly stated you started a new one because no one was replying...agree?Anyways: Simply stick to a single thread and answer to the replies you are getting as that could be considered polite behavior.Jos Edited September 20, 2015 by 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. Share this post Link to post Share on other sites
christian11 0 Posted September 20, 2015 There wasn't much to misunderstand in your previous post as that clearly stated you started a new one because no one was replying...agree?Anyways: Simply stick to a single thread and answer to the replies you are getting as that could be considered polite behavior.JosIts been 11 hours and no ones replying so I just thought probably my macro is too hard and seems impossible to automate. so i decided to try another different macro instance . thanks btw. i already edited my posts and title. i hope they didnt confuse because the replies are kinda confusing from the thread Share this post Link to post Share on other sites
water 2,359 Posted September 20, 2015 The forum netiquette expects users to wait at least 24 hours before bumping a thread.BTW: What is a "priority pixel"? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites