Jump to content

1 Hour of failure with the search button


hookLine
 Share

Recommended Posts

I want AutoIt to find a color and then move the mouse to it and left click on it. This is what I have so far:

Opt("PixelCoordMode", 0)
Opt("MouseCoordMode", 0)

HotKeySet("{F10}", "tp")

$tp_color = PixelSearch(189, 111, 357, 235, 0x484848, 15)

While 1
    Sleep(20)
WEnd

Func tp()
    Send("{F8}")
    MouseClick("right")
    Sleep(1300)
        If IsArray($tp_color)=1 Then
            MouseClick("left", $tp_color[0], $tp_color[1], 1, 0)
            Sleep(300)
        EndIf
EndFunc

It looks like it should work, but it doesn't! I have a feeling that I did something wrong the coordinates of the rectangle. Someone please help me!

Link to comment
Share on other sites

*** NOT TESTED

Opt("PixelCoordMode", 0)
Opt("MouseCoordMode", 0)

HotKeySet("{F10}", "tp")

While 1
    Sleep(20)
WEnd

Func tp()
    
    Send("{F8}")
    MouseClick("right")
    Sleep(1300)
    
    $tp_color = PixelSearch(189, 111, 357, 235, 0x484848, 15)
    
    If IsArray($tp_color) = 1 Then
        MouseClick("left", $tp_color[0], $tp_color[1], 1, 0)
        Sleep(300)
    EndIf
EndFunc   ;==>tp

8)

NEWHeader1.png

Link to comment
Share on other sites

*** NOT TESTED

Opt("PixelCoordMode", 0)
Opt("MouseCoordMode", 0)

HotKeySet("{F10}", "tp")

While 1
    Sleep(20)
WEnd

Func tp()
    
    Send("{F8}")
    MouseClick("right")
    Sleep(1300)
    
    $tp_color = PixelSearch(189, 111, 357, 235, 0x484848, 15)
    
    If IsArray($tp_color) = 1 Then
        MouseClick("left", $tp_color[0], $tp_color[1], 1, 0)
        Sleep(300)
    EndIf
EndFunc   ;==>tp

8)

Thanks for the help, but it seems to misclick the area I want it to click on. It probably has something to do with my rectangle coords :)

I'll upload a video in a moment so you can have a better understanding of what I want it to do.

Link to comment
Share on other sites

Thanks for the help, but it seems to misclick the area I want it to click on. It probably has something to do with my rectangle coords o:)

I'll upload a video in a moment so you can have a better understanding of what I want it to do.

It did have something to do with my rectangle coords, the rectangle was too big than necessary! :)

And the range of shades were too high, and it was finding other areas to click on. Thanks for your help! :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...