christian11 Posted September 20, 2015 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
christian11 Posted September 20, 2015 Author 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
kaisies Posted September 20, 2015 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?
computergroove Posted September 20, 2015 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
water Posted September 20, 2015 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
computergroove Posted September 20, 2015 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
christian11 Posted September 20, 2015 Author 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
water Posted September 20, 2015 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Developers Jos Posted September 20, 2015 Developers 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.
christian11 Posted September 20, 2015 Author 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()
Developers Jos Posted September 20, 2015 Developers 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.
christian11 Posted September 20, 2015 Author 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
water Posted September 20, 2015 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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