Jump to content

Click a color


Pharon
 Share

Recommended Posts

I've looked through autoit help and couldn't find it, I need to make the mouse click when a certain color isn't under the mouse anymore. So lets say there is black under the mouse, and something red moves to where to mouse is, I want it to click while that color is there and stop when it moves away.

Link to comment
Share on other sites

Hmm, didn't do what I needed, how would I change it so that it will click when the color is under the mouse? I need to do this for about three colors, if this one isn't there then check for this, if not that one then check for this one. Along the way if any of them are under the mouse then click it.

Link to comment
Share on other sites

hmmm... study larrys code, look in the help file for the functions he used. theres not going to be one single function that does specifically every thing you want it, but you can make a fucntion that will, just think outside the box...

FootbaG
Link to comment
Share on other sites

HotKeySet("=", "MyExit")
HotKeySet("[", "MyStop")
HotKeySet("-", "MyStart")

Do
Until 0

Func MyStart()
$s = 1
Do
If $s = 1 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x219988 )
If @error Then
$s = $s + 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf

If $s = 2 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x020380 )
If @error Then
$s = $s + 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf

If $s = 3 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x818507 )
If @error Then
$s = $s + 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf

If $s = 4 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x9E9E9E )
If @error Then
$s = 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf
Until $s = 99
EndFunc

Func MyStop()
    $s = 99 
EndFunc

Func MyExit()
    Exit 
EndFunc

Well, I tried to make it detect a color then put the mouse to it, but for some reason every time I run it I get a error saying that "Until $s = 99" has no matching Do statement, but there is one right at the begining.

Link to comment
Share on other sites

lol

try this

do

your code

until

EDIT: no wait, you DO have it in the right place, but you still have until 0

you need to erase that until 0 right under do

EDIT2: sheesh, now i see another do in there also

here... just get rid of this

Do

Until 0

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

yep, i ran your code, i get the same error

maybe instead of do until, use a while loop

while $s > 0

your code

wend

then to stop it,

$s = ""

and i think the problem is in all those if statements. too damn many

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

Yeah, but I couldn't think of a shorter way to make the script besides all the If statements, and I found out I need to put another color in there so if it's the If statements there will be another one.

Edit: tried it and it says the wend statment has no while...

Edited by Pharon
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...