Jump to content
Sign in to follow this  
dustinev

Help with a short script

Recommended Posts

dustinev

Hello. I am in need of a script that gets the color of a pixel (say at 500,500 for example) and clicks the left mouse button after 2-3 seconds if that pixel is not a certain color. Thanks for any help!

Share this post


Link to post
Share on other sites
Andreik

Hello. I am in need of a script that gets the color of a pixel (say at 500,500 for example) and clicks the left mouse button after 2-3 seconds if that pixel is not a certain color. Thanks for any help!

$COLOR = PixelGetColor(500,500)
If Hex($COLOR,6) <> 0xFFFFFF Then;If color is not black click to 500,500
    Sleep(2000)
    MouseClick("left",500,500)
EndIf

When the words fail... music speaks

Share this post


Link to post
Share on other sites
dustinev

$COLOR = PixelGetColor(500,500)
If Hex($COLOR,6) <> 0xFFFFFF Then;If color is not black click to 500,500
    Sleep(2000)
    MouseClick("left",500,500)
EndIf
Thanks for the quick reply!

Okay, now lets say I want it to get the color of a pixel at position 500,500 and if the color at that position is 0xFFFFFF, click the left mouse button. I also need it to loop indefinitely. Would the following work?

$COLOR = PixelGetColor(500,500)
While 1=1
If $COLOR = 0xFFFFFF Then
    Sleep(2500)
    MouseClick("left",500,000)
EndIf
WEnd

Share this post


Link to post
Share on other sites
Andreik

Thanks for the quick reply!

Okay, now lets say I want it to get the color of a pixel at position 500,500 and if the color at that position is 0xFFFFFF, click the left mouse button. I also need it to loop indefinitely. Would the following work?

$COLOR = PixelGetColor(500,500)
While 1=1
If $COLOR = 0xFFFFFF Then
    Sleep(2500)
    MouseClick("left",500,000)
EndIf
WEnd
Yes just put a sleep in your loop.

$COLOR = PixelGetColor(500,500)
While 1
If $COLOR = 0xFFFFFF Then
    Sleep(2500)
    MouseClick("left",500,000)
EndIf
Sleep(20)
WEnd

When the words fail... music speaks

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.