Jump to content
Sign in to follow this  
BlasphM

PixelSearch-Mouseclick help

Recommended Posts

BlasphM

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!

Share this post


Link to post
Share on other sites
JFee

Shouldn't the code read:

MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,0)

Were you getting a subscript error?


Regards,Josh

Share this post


Link to post
Share on other sites
duckling78

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.