ashbeast

PIXEL SEARCH NOT WORKING

6 posts in this topic

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)
    EndIf

Problem is its not searching for the pixel whether the color is matched or not matched its exicuting the if part only why ?

 

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 code

AutoItSetOption("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 Then
MouseMove(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)
    



EndIf

Pixel 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 by ashbeast

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.