ashbeast Posted November 29, 2015 Share Posted November 29, 2015 Hello ,Im doing a pixel color search and if color found do some actions else do some acions here is my code$aCoord = PixelSearch(214,93 , 226, 109,0xFDCE29 ,$hWhnd) If Not @error Then MouseMove(252, 201,5) Sleep(1000) MouseDown($MOUSE_CLICK_LEFT) ; Set the left mouse button state as down. Sleep(100) MouseUp($MOUSE_CLICK_LEFT) ; Set the left mouse button state as up. Sleep(500) MouseMove(866, 286,5) Sleep(500) MouseDown($MOUSE_CLICK_LEFT) ; Set the left mouse button state as down. Sleep(100) MouseUp($MOUSE_CLICK_LEFT) ; Set the left mouse button state as up. $E = True ;ExitLoop Else Sleep(3000) EndIfProblem is its not searching for the pixel whether the color is matched or not matched its exicuting the if part only why ? Link to comment Share on other sites More sharing options...
water Posted November 29, 2015 Share Posted November 29, 2015 Welcome to AutoIt and the forum!It's a bit hard to tell where the problem is without seeing the whole script or - even better - a screenshot of the application you try to automate. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ashbeast Posted November 29, 2015 Author Share Posted November 29, 2015 (edited) Welcome to AutoIt and the forum!It's a bit hard to tell where the problem is without seeing the whole script or - even better - a screenshot of the application you try to automate.this is my full codeAutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode" ,0) Sleep(1000) Local $hWhnd = WinGetHandle("[CLASS:FIFAKC]") WinActivate($hWhnd) $aCoord = PixelSearch(274,94 , 291, 118,0xFDCE29,$hWhnd)If Not @error ThenMouseMove(324, 199,5) Sleep(1000) MouseDown($MOUSE_CLICK_LEFT) ; Set the left mouse button state as down. Sleep(100) MouseUp($MOUSE_CLICK_LEFT) ; Set the left mouse button state as up. Sleep(500) MouseMove(866, 286,5) Sleep(500) MouseDown($MOUSE_CLICK_LEFT) ; Set the left mouse button state as down. Sleep(100) MouseUp($MOUSE_CLICK_LEFT) ; Set the left mouse button state as up. $E = True ;ExitLoop Else Sleep(3000) EndIfPixel search should be done respective to the active window not the screen so that even if i move the window it should search according to window if i remove $hWhnd in pixel search everything works fine but it searches according to screen pixels not window pixels Edited November 29, 2015 by ashbeast Link to comment Share on other sites More sharing options...
water Posted November 29, 2015 Share Posted November 29, 2015 Am I correct that you try to automate the "EA SPORTS FIFA" game? That's the only hits I got from Google. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ashbeast Posted November 29, 2015 Author Share Posted November 29, 2015 Am I correct that you try to automate the "EA SPORTS FIFA" game? That's the only hits I got from Google.yes you are right Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 29, 2015 Moderators Share Posted November 29, 2015 (edited) @ashbeast, you seem to have missed the forum rules on your way in. Please review them now, especially the part about game automation, and you will see why this topic is locked. Hope to see you soon with a legitimate question. Edited November 29, 2015 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts