Sign in to follow this  
Followers 0
TokeySmurf

PixelSearch - Works to a certain point then crashes - help appreciated

6 posts in this topic

Here we go, It works fine , then when it gets to a certain point I get an error. here's code and error

controlsend($handle, "", "", "Keys Here{Enter}")
sleep(5000) 
 Global $coord = PixelSearch(0, 0, 1024, 768, 0x123C6F)
If @error Then
    MsgBox(16, "Error", "Second color not found.")
Else
                 Global $coord2 = PixelSearch(0, 0, 1024, 768, 0xB0A17D)
                 MouseMove($coord[0], $coord[1])
    Sleep(5000)
    MouseClick("Right", $coord[0], $coord[1], 2)
    Sleep(5000)
    sleep(2000)
    MouseClick("Left", $coord2[0], $coord2[1], 2) ;it Breaks here with error 
;Line (105) : ==> Subscript  used with non-Array variable.: MouseClick("Left", $coord2[0], $coord2[1], 2) 
;MouseClick("Left", $coord2^ ERROR
    sleep(5000)

Also, Would there be a way to make like a box that the pixelsearch could find but click through it? sort of like giving it a Sure shot target?

EndIf

EndFunc

Share this post


Link to post
Share on other sites



You have an @error checking the first PixelSearch() but no such condition for the 2nd.

You're box idea? I have no clue what your talking about... good luck with that.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

You have an @error checking the first PixelSearch() but no such condition for the 2nd.

You're box idea? I have no clue what your talking about... good luck with that.

Thanks for the help, I'll test it out. But as for the "box idea" Make a box circle whatever can be really really small thats moveable with the color you want pixelsearch to find, Basically make them targets but small enough, or some other magical way of clciking through them. And I want to use it off this program say make a Func CreateTarget() creates a Bright Purple that stays on top so you can click on whats behind it

Share this post


Link to post
Share on other sites

Thanks for the help, I'll test it out. But as for the "box idea" Make a box circle whatever can be really really small thats moveable with the color you want pixelsearch to find, Basically make them targets but small enough, or some other magical way of clciking through them. And I want to use it off this program say make a Func CreateTarget() creates a Bright Purple that stays on top so you can click on whats behind it

That just seems like extra work... You'd need to create the function with Pixel*() to follow the color, so why create a box... the box serves 0 purpose if your Pixel* functions are already following it.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

That just seems like extra work... You'd need to create the function with Pixel*() to follow the color, so why create a box... the box serves 0 purpose if your Pixel* functions are already following it.

But the pixel functions are having a very hard time finding the right pixel due to so many colors, There is no real Unique Color so i Was hoping I could Create a box or circle whatever it may be from a window item that could be moved on top of the said target it making it static.

Anyhow, The pixel thing really isn't working, I was trying to go with something else than input fields. But honestly I'm finding the input fields would work better however, I didn't get the answer I was looking for in

http://www.autoitscript.com/forum/index.php?showtopic=32515

If you could help me out that'd be awesome. I may take a couple day break on this script I dunno, Its racking my brain and I seriously havn't moved from the computer, Inbetween my post is about how long I'm working on it.. doh.

Share this post


Link to post
Share on other sites

But the pixel functions are having a very hard time finding the right pixel due to so many colors, There is no real Unique Color so i Was hoping I could Create a box or circle whatever it may be from a window item that could be moved on top of the said target it making it static.

Anyhow, The pixel thing really isn't working, I was trying to go with something else than input fields. But honestly I'm finding the input fields would work better however, I didn't get the answer I was looking for in

Ask yourself a question.... If I create a box to follow the "color", how am I supposed to program the box to do that? (Hint... the same pixel functions your having issues with at the moment :) ).

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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