Jump to content

PixelSearch-Mouseclick help


Recommended Posts

Hi everyone,

I have a small problem, i'm trying to make a quick macro to actually just click on something coloured, then sleeping, and try to click on the same color somewhere else.

Here's my try:

$mob = "0x8D7A6B"; Je déclare la couleur de mon mob - That's the colour i'd like to clik

$pixelSearch=PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$mob);Je recherche la couleur sur l'écran (size desktop) - searching for the pixel, desktop size 1680x1050

If IsArray($pixelSearch)=1 Then;Si la couleur à été trouvé, then - if the colour have been found, then
MouseClick("left",$pixelSearch[200],$pixelSearch[1],1,0);Je click gauche sur le pixel trouvé, position éxacte - then left click on the pixel found
Sleep 1000

EndIf

Well when i try this, it launch, but nothing happens and it stops, i think i have to make this looping, and then see what's happening IG, any clues of how could i do that?

Every advice would be helpfull, thanks!

Link to comment
Share on other sites

Maybe this will work for you?

HotKeySet("{Esc}", "ExitScript")

$mob = 0x8D7A6B

While 1
    $pixelSearch=PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$mob)

    If IsArray($pixelSearch) Then
        MouseClick("primary", $pixelSearch[0], $pixelSearch[1], 1, 0)
    Else
        ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & ": " & "Color 0x" & Hex($mob) & " was not found." & @CRLF)
    EndIf
    
    Sleep(1000)
WEnd

Func ExitScript()
    Exit
EndFunc
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...