boat_58 0 Posted December 20, 2020 Is it possible to do multiple pixel searches at the same time? if so how do i go about in setting it up? For example: 3 scripts that i have to search for 3 different pixels with each doing the same thing if it finds the pixel and locks. It seems to work, but is there a more efficient way to set this up so that all 3 pixel searches are going the same time and which ever color is found first, is what is ran until the action is completed and it start searching again? Quote expandcollapse popupWhile (1) $cord = PixelSearch(1653, 575, 232, 99, 0x661212, 3) ;hunt for pixel If Not (@error) Then MouseClick("right", $cord[0], $cord[1], 1, 1) Sleep(2000) $highlighted = True While ($highlighted) $highlighted = PixelSearch(1065, 712, 1067, 714, 0x988327, 2) If Not (@error) Then MouseClick("left", 141, 1060) Sleep(1100) ; pause for 1 sec Else $highlighted = False EndIf WEnd Else $cord = PixelSearch(1653, 575, 232, 99, 0x661214, 3) ;hunt for pixel If Not (@error) Then MouseClick("right", $cord[0], $cord[1], 1, 1) Sleep(2000) $highlighted = True While ($highlighted) $highlighted = PixelSearch(1065, 712, 1067, 714, 0x988327, 2) If Not (@error) Then MouseClick("left", 141, 1060) Sleep(1100) ; pause for 1 sec Else $highlighted = False EndIf WEnd Else $cord = PixelSearch(1653, 575, 232, 99, 0x661213, 3) ;hunt for pixel If Not (@error) Then MouseClick("right", $cord[0], $cord[1], 1, 1) Sleep(2000) $highlighted = True While ($highlighted) $highlighted = PixelSearch(1065, 712, 1067, 714, 0x988327, 2) If Not (@error) Then MouseClick("left", 141, 1060) Sleep(1100) ; pause for 1 sec Else $highlighted = False EndIf WEnd Else ;turn 45 degrees MouseMove(850, 475) MouseDown("right") MouseMove(1088, 475) MouseUp("right") EndIf WEnd Share this post Link to post Share on other sites
Dan_555 74 Posted December 20, 2020 Replace the else's with endif's Share this post Link to post Share on other sites
Aelc 25 Posted December 20, 2020 (edited) your script isn't working at all.. if i understood right you are looking for something like While 1 For $i = 2 To 4 Local $cord = PixelSearch(1653, 575, 232, 99, "0x66121" & $i, 3) If IsArray($cord) Then MouseClick("right", $cord[0], $cord[1], 1, 1) Sleep(2000) Do Local $highlighted = PixelSearch(1065, 712, 1067, 714, 0x988327, 2) Sleep(10) Until IsArray($highlighted) MouseClick("left", 141, 1060) Sleep(1100) EndIf Next ; _turn() sleep(10) WEnd Func _turn() MouseMove(850, 475) MouseDown("right") MouseMove(1088, 475) MouseUp("right") EndFunc ;==>_turn not tested! actually im not sure what exactly you want but maybe this show you the way. i just rescripted the given script but the "else" aren't that clear since you didn't close the if statements EDIT: by the way i would set a hotkey to trigger it. I deactivated the constantly mousemove so far, because it would be annyoing Edited December 20, 2020 by Aelc why do i get garbage when i buy garbage bags? Share this post Link to post Share on other sites
water 2,393 Posted December 20, 2020 Working with Mouse* and Pixel* functions isn't very reliable as they depend on screen size and resolution, window position etc. Can you please tell us which application you try to automate? Most of the time there are better ways to do what you want to do. 1 Aelc reacted to this 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