Sign in to follow this  
Followers 0
Pharon

Click a color

10 posts in this topic

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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

oh i get it

do

until 0 keeps the program active

hmm, let me look at this


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

Share this post


Link to post
Share on other sites

im stuck as well


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

Share this post


Link to post
Share on other sites

The only thing I could think of is that there is to much code between the Do and Until that it doesn't remember there is a Do up there. o.O I really doubt that's it though.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

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  
Followers 0